Posts

Showing posts from November, 2023

Salesforce Fact #800 | Another POC with Http callout from flow

Image
Sometimes we need to work on some finance related requirement where the amount needs to be shown in words as well like the option we have in physical cheques. We can use a web service callout to do get the details and that can be invoked from a screen flow. Note: This one does not work on digits after the decimal. Attached are the screenshots.

Salesforce Fact #799 | Change response data type in flow callout

Image
While using Http callout in flow, it is possible to change the output format of the response from application/json. To change this, Setup -> External Services -> Click on the Actions dropdown for the respective external service-> Edit -> change the content to the required format e.g. text/plain -> Save & Next Reference:  https://salesforce.stackexchange.com/questions/409668/how-to-use-http-callout-action-in-flow-with-body-of-content-type-application-x Attached is one sample screenshot.

Salesforce Fact #798 | Getting selected label from lwc combobox

Image
While using lightning-combobox, we can get the selected option value using event.detail.value, but not the label. To get the selected label, we need to use a bit of logic. Attached is the screenshot.

Salesforce Fact #797 | LWC getRecord with record picker

Image
We can use LWC getRecord with lightning-record-picker to fetch the field values of the selected record. Attached are the screenshots.

Salesforce Fact #796 | Lead already converted

If we try to convert an already converted lead by mistake, we encounter the error 'CANNOT_UPDATE_CONVERTED_LEAD'. It shows the date as well on which the lead was converted. Reference:  https://help.salesforce.com/s/articleView?id=000384333&type=1

Salesforce Fact #795 | Readonly lightning record picker

Image
Suppose we want to make the lightning-record-picker readOnly once a value is selected. This is how we can implement this, since it does not support disabled or readOnly attributes. Attached is the screenshot.

Salesforce Fact #794 | Reset value in LWC record picker

Image
We can use the clearSelection() method to reset the value in lightning-record-picker. Reference:  https://developer.salesforce.com/docs/component-library/bundle/lightning-record-picker/specification Attached is the screenshot.

Salesforce Fact #793 | Getting selected recordId in lightning record picker

Image
So, this is how we can access the selected record Id in lightning-record-picker. Attached are the screenshots.

Salesforce Fact #792 | Iterate over two lists in same loop

Image
Suppose we have two lists of different length and we want to iterate over the lists in the same loop. We can do this by using some logic in apex. Attached is the sample code snippet.

Salesforce Fact #791 | spanning relationship in lightning record picker

Image
Filtering in lightning-record-picker also supports spanning relationships upto one level. Reference:  https://developer.salesforce.com/docs/component-library/bundle/lightning-record-picker/documentation Attached is the screenshot.

Salesforce Fact #790 | passing value in lightning record picker filter

Image
We can pass value dynamically as well in the filter of lightning-record-picker. For example, suppose we are using a contact record picker and we would like to select only the related contacts for the current account. The LWC is placed in the account record detail page. We can pass the current accountId in the filter. Attached are the screenshots.

Salesforce Fact #789 | Reactive display text in screen flow

Image
With the latest release, we now have the option to opt for enabling reactivity in display text component in screen flow. To enable this, go to Setup -> Process Automation Settings -> check 'Opt in to Reactive Display Text Beta'. In this example, we have a picklist and the selected value is shown in the same screen in the display text component. Attached are the screenshots.  

Salesforce Fact #788 | Dynamic record picker in screen flow using LWC

Image
So now we have lightning record picker base component in LWC. Using this we can create a dynamic record picker which can be used inside a screen flow and the parameters can be passed from the screen flow as per the requirement. In this example, we are fetching contact records which have both email and phone populated. Attached are the screenshots.

Salesforce Fact #787 | UserPermissionAccess

There is an object named UserPermissionAccess which represents the permissions accessibility of the current user. We can use Get Records element on this object in flow to check permissions like 'Activate Contracts' or 'Activate Orders' of the current user. Reference:  https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_userpermissionaccess.htm

Salesforce Fact #786 | Invoke quick action from LWC

Image
Suppose we have a use case where we need to invoke a quick action from LWC on button click. We can implement the same by wrapping the LWC inside an Aura and using lightning:QuickActionAPI. In this example, we are invoking a Create Record(Contact) quick action from Account detail page. Reference:  https://developer.salesforce.com/docs/component-library/bundle/lightning:quickActionAPI/documentation Attached are the screenshots.

Salesforce Fact #785 | lightning record picker in LWC

Image
So we have a whole new tag in lwc, lightning-record-picker. This renders a record select lookup. It uses GraphQL wire adapter to fetch the records and also returns the records as per the user access i.e. in with sharing mode. Reference:  https://developer.salesforce.com/docs/component-library/bundle/lightning-record-picker/documentation Attached are the screenshots.