Posts

Salesforce Fact #189 | Restrict access to custom settings

Image
Suppose we want to restrict the access to all the custom settings for users of a particular profile. For this, we need to disable the two system permissions: Customize Application & View All Custom Settings. On disabling these two permissions, the users won't see any edit, del or manage option for the custom settings. Attached are the screenshots.  

Salesforce Fact #188 | Be careful with current user Id in flow

Image
We need to be careful while dealing with current user Id from the $User global variable in flow. It returns the case sensitive Id of 15 character length. So during the Id comparison we may experience discrepancy, as the standard userId storing fields in object stores the Id in 18 character case insensitive format. Therefore, in the flow we can use a formula field and store the current user Id after applying the CASESAFEID function to get the equivalent 18 character version. Attached are the screenshots.

Salesforce Fact #187 | Share related records using flow

Image
Suppose we have a use case where we need to share the related records when the parent record owner is changed. The related records need to be shared with the same person. We can use record triggered flow and the share object to achieve this. In this example, we have Account object and another object Enrollment has a lookup on this. Now the requirement is, once the account owner is changed, the related enrollments would also be shared with the same person. But the access would be read only. Attached are the screenshots.

Salesforce Fact #186 | Insert DML on NULL in screen flow

Image
We all know that DML on NULL reference yields error in apex. But that is not the case in screen flow. Suppose, we are inserting two account records in a single DML and by mistake we forgot to initialize the second account. This will be caught in apex and it will report error. But in flow it didn't generate any error and created the first account and skipped the second one. Not sure if it is a bug or not, but definitely a point to keep a note of. Attached are the screenshots.    

Salesforce Fact #185 | Open report from screen flow

Image
As admin, we can have a screen flow to quickly navigate to a report instead of going to the reports tab and then search the folder and then open the report. From the screen flow, we can simply click on the report link to open the particular report. The report link will be constructed based on our selected choice. It is an easy approach to move to reports quickly which do not contain any filters. The downside here is we are using record choice set, so if there are huge number of reports it would not work well. So instead we can have one more picklist to ask the user first the letter and then we can show the report names starting with that only and this will also return less number of records. Attached are the screenshots.

Salesforce Fact #184 | Picklist visibility dependency in screen flow

Image
Suppose we would like to have visibility dependency on picklist in screen flow. Then we can make use of the component visibility option to render a picklist only of the prior one is populated with values. Attached are the screenshots.

Salesforce Fact #183 | Pass account name and related contacts from flow to LWC

Image
Suppose we have to pass account name and related contacts from flow to LWC. This can be achieved using the apex defined type, using two variables: one for account name and another for the related contact list. And in LWC, the same way we have to set the targetconfig property. Attached are the screenshots.