Posts

Salesforce Fact #127 | Get deleted records in flow

Image
Suppose we have a requirement to access deleted records in flow. No worries. We have an object called Recycle Bin Item in flow which stores the deleted records. In this example, I am fetching the deleted contact records in flow. Attached are the screenshots.  

Salesforce Fact #126 | Active flow in quick action

In case a screen flow is used as a quick action, the button is only visible when the flow is active. The quick action button is not visible when the flow is inactive.  

Salesforce Fact #125 | Dynamic Picklist in screen flow

Image
Suppose, We have a type field in both account and contact and it is a picklist field. Now as per the requirement, based on the option selected by the user, the corresponding type options must be displayed in flow screen. If the user selects Account, the type picklist will show account type values, and if the user selects Contact, it will show contact type values. We can use picklist choice set along with component visibility option to achieve this. Attached are the screenshots.

Salesforce Fact #124 | Pick picklist carefully

Image
We need to be careful while working with picklists, especially restricted picklists. It is the api name which we populate in the field, not the picklist value. In most of the cases, the api name and value is same, so we do not get the difference. In this example, I have added a new picklist value Success with the api name as Con_Success in one picklist field of contact. We get error when the value is used, but using the api name does not show any error. Attached are the screenshots.    

Salesforce Fact #123 | Total count in flow

Image
Suppose, we are using get records in flow to fetch account and contact records based on some condition. Once the records are fetched, we need to calculate the sum of the record count. We can do that in a single assignment element using a third temp variable. It also proves that assignment operations are processed sequentially. Attached are the screenshots.  

Salesforce Fact #122 | Prevent on insert

Image
Suppose we have a requirement that we can enter data in a field only after the record is created. We can define validation rule to achieve this. Using ISNEW() we can do that. Another alternative is checking ISBLANK(ID) since Id field is populated only after a record is created. Attached are the screenshots.

Salesforce Fact #121 | Switch case apex

Image
When clause in switch statement considers only literal value. It does not accept variable or final value. Attached is the screenshot. For more details check:  https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_switch.htm