Using Custom Label in Lightning Web Components – LWC

Quick Code Snippet on how to use custom label in Lightning Web Components – LWC

Below is code snippet on using custom labels in Lightning Web Components.

Assume, we have custom label named welcomeText and exitText

In Javascript file of LWC, we have to follow below syntax

// CustomlabelExample.js
import { LightningElement } from 'lwc';
 
// Import custom labels
import welcomeText from '@salesforce/label/c.welcomeText';
import exitText from '@salesforce/label/c.exitText';


export default class CustomLabelExample extends LightningElement { 

    // Expose the labels to use in the template.
    label = {
        welcomeText,
        exitText
    };
}

Notice, how we imported label and used c. if there is no namespace.

import welcomeText from '@salesforce/label/c.welcomeText';
<!-- CustomlabelExample.html -->
<template>
    Hi , {label.welcomeText} !!! 
   <!-- some more code --> 
   Sorry to see you going, {label.exitText}
</template>

Reference :

Sharing records in partner community from different Accounts

As we know there are limited options to share records between community users.

For Customer Community , we can use Sharing set or Sharing Group.

For Customer Community Plus & Partner Community we can use role & Sharing rule. Maximum role that community can have is 3 per account and thats limitation there as well.

Now , lets assume below scenario

Continue reading “Sharing records in partner community from different Accounts”

Salesforce Integration Patterns & Best Practices – with Video

When to use which integration patterns in Salesforce along with best practices. Video to show how to use Outbound message to integrate Salesforce without writing code

Recently I gave talk in one of most active webinar of Salesforce ecosystem today – Apex hours on topic Integration Patterns and Best Practices in Salesforce.

Response was more than expected and questions were high quality. Therefore, I thought to quickly write high level summary of presentation in this blog post along with Youtube video that you can find towards the end of this post.

Firewall, Proxy and Reverse Proxy

Before integrating anything with Salesforce, as per Architect, it is necessary which system components are important for security and may impact with integration pattern to be used.

Firewalls : It controls and protects Malicious Traffics. Firewall can be hardware or software based.

Proxy aka Forward Proxy : Proxy normally configured in your browser or systems like VsCode, data loader, eclipse to hide your actual identity. Every outgoing request transmits through proxy server to make sure external systems unaware about your true origin and identity

Reverse Proxy : Its used by Web Servers and sits before it. It can server any purpose like authentication or perform security related stuff. Best example is Mulesoft where we can configure API proxy which is used to apply throttling, avoiding DoS attacks or applying SLA as per licenses provided to customer

Continue reading “Salesforce Integration Patterns & Best Practices – with Video”

Mastering Visual Studio and Salesforce DX

Author posted by Jitendra on Posted on under category Categories Salesforce and tagged as Tags , , with 1 Comment on Mastering Visual Studio and Salesforce DX

3.5 hours of video to become Master on using and navigating Visual Studio, Need of scratch org and building modular application using Unlocked Packages

I’m delighted to announce new Udemy course Mastering Visual Studio & Salesforce DX recorded by me and my friend Amit Chaudhary.

This course is for

This course is for you if answer to any of below question is yes

  • New Salesforce Developer and wondering how Visual Studio and Salesforce DX fits together
  • Salesforce Admin who don’t want to stay behind adapting source based development methodology
  • Experience Salesforce developer worked immensely on force.com IDE and ANT migration toolkit but not able to fit with new development paradigm
  • Advance developer or Architect who wants to understand how Unlocked package is different than manage package and unmanaged package
  • Want to streamline CI / CD process by developing some advance plugin

Curriculum

  1. What is Salesforce DX and why do we need it if we already had ANT based metadata tool
  2. How to remember Salesforce DX
  3. How admins can use Visual Studio without knowing Salesforce DX command
  4. Why do we need Scratch Org and difference between scratch org and Sandbox
  5. When to use Scratch Org
  6. How to perform relational data load using SalesforceDX
  7. Automating scripts , from 10 commands to single command
  8. How JWT OAuth works with Salesforce DX
  9. How Salesforce DX plugin boiler plate can be created within 5 minutes

Udemy is running huge sale , Click below image to get discounted price for this course !!!

Trailhead Challenge Errors & Solutions

Solutions to error or problem faced while completing Trailhead Challenges

Sometime Salesforce Trailhead Challenge requirement and actual solution doesn’t go hand in hand. And seems many others also face same issue , Thats why I would be making notes on how I fixed Trailhead challenge issue.

Note : I would not be sharing solutions of Trailhead challenge , I will post fix only when there is discrepancy in what’s being asked and what worked.

Setup Escalation and Entitlement

Solution to this challenge would not work if you have Person Account enabled in Org. Try solution in non Person Account Org.

Error : The second Block Price for the Mobile Control Center App is not configured correctly. Check the Lower Bound, Upper Bound, and Price.

Pricing Methods for Salesforce CPQ – Implement Block Pricing

Solution : Create Block Line items as per below image. Salesforce is clearly asking for 1-4 but it needs 5 as upper limit. 5-10 but it needs 11 as upper limit.

Error : We can’t find the Product family named Service Packages

While trying completing trailhead challenge Create and Customize Products , I kept getting error We can’t find the Product family named Service Packages. Everything was correct in my org but this error was persistant. Then I temporarily changed org and clicked on challenge button. It failed and then switched to actual org again and this time challenge completed successfully. It seems some kind of caching issue which gets cleared after switching org to check challenge.

Podcast – How to Achieving Hyper-Threading in Salesforce

Total number of Asynchronous Apex which includes Batch Apex, Future Method, Queueable & Scheduled job is 250k or 200 x Total User license whichever is greater.

Now lets do some fact check :

  • Execute method of Batch Apex can only call 1 Queueable
  • Scheduler can call 50 Queueable
  • We can have only 100 Schedulers in an Org
  • If we run 1 Scheduler every minute = 60 Scheduler
  • If each Scheduler executes 50 Queueable every minute, then 60×50 = 3000 jobs / min. Which means 3000 x 24 = 72k jobs / day

Big Question

Can you design an application which can use full potential of Async governor limit – even 250k / day ?

Designing Scalable Hyper Thread Application in Salesforce

I have discussed various approach to answer these questions on below podcast by SalesforceWay

Part 1 – Salesforce Hyper-Threading Road blocks

Part 2 – Salesforce Hyper-Threading Options

Feel free to drop comments and your thoughts on solution !!!

Federated Search in Salesforce

Search content of Jitendra Zaa’s blog using federated search in Salesforce

Using Federated Search, we can search for content outside Salesforce. Federated Search utilizes Open Search Document behind the scene. Open Search was coined by Jeff Bezos (CEO – Amazon) in March 2005. Open Search is a collection of technologies & standards that allows publishing of results to be utilized by Search Engines.

For Demo purpose, I have enabled my website compatible with Open Search at below URL

https://www.jitendrazaa.com/blog/wp-json/opensearch/1.1/document

Step 1 :

Add External Data Source by clicking New External Data Source.

Provide any suitable name – in this case Jitendra’s Blog.

Select Federated Search : OpenSearch as Type.

Provide this path for OSD (Open Search Document) file format – https://www.jitendrazaa.com/blog/wp-json/opensearch/1.1/document

Click on Validate and Sync.

Step 2 :

Create permission set giving permission to view this External Object and all fields. Assign this permission set to anyone who needs to use search for content outside Salesforce.

We can also enable this federated search in Communities by updating global Search Component and giving community members access to this newly created permission set.

Once above setup is completed – you can search for any term on global search and select External Results as shown in below image :

Install Manage Package in Scratch Org using Salesforce DX

Install CPQ, Field Service Lightning, B2B Commerce cloud in Scratch Org using SFDX Command

There are tons of useful SFDX commands available to help automate Salesforce deployment. However one of most important aspect of Salesforce DX is capability of spinning org within few minutes with features enabled like Person Account, Communities etc.

There could be times, where these commands might not be sufficient. I recently cam across such scenario where I wanted to install manage package for quick capability check.

Scanned through documentation, Stack Exchange and spent lots of time figuring out on how to automate package installation. There are many commands available to install second generation package but not manage package itself. Then I came across marty chang’s github repository with instruction.

Continue reading “Install Manage Package in Scratch Org using Salesforce DX”

Use Lightning Web Components in Flow

Endless limit for your Salesforce application by combining Flow with Lightning Web Components (LWC)

As part of Winter 20, we can embed Lightning Web Components in Flow. Imagine, endless possibilities for Rapid Application Development (RAD) and ease of maintaining application.

Few examples where this could come handy are like embedding lookup components (no more workaround), showing data table, capturing signature, slide shows and so on.

It’s time to jump into water. In this blog post, I would be creating Simple Lightning Web Component (LWC). This LWC Component would be able to get value from flow, pass value to flow, navigate to Next screen and hookup into flow validation engine to restrict next page navigation if there is error in LWC input.

Note : Read this blog post to learn how to embed Aura Component in Flow.

Continue reading “Use Lightning Web Components in Flow”

Event Handling between Aura, Lightning Web Components (LWC) and Visualforce

How to use Lightning Message Services for event handling between Lightning Web Components, Aura Components and Visualforce

Few months back, I wrote an article on how pub sub model can be used to communicate between Lightning Web Components. In that blog post, we used external library to pass event from child to Lightning Web Components.

Lightning Message Service

In Winter 20, Salesforce released Lightning Message Service which can be used to exchange data between Visualforce, Aura Component and Lightning Web Components. Unlike previous process, we don’t need to import any external library like pub or sub.

In this blog post, I would be creating Visualforce, Aura Component and Lightning Message Service and exchanging message between all of them using Lightning Message Service.

Continue reading “Event Handling between Aura, Lightning Web Components (LWC) and Visualforce”