Posts

Showing posts with the label screen flow

Salesforce Fact #1000 | Call expression set in flow screen action

Image
We can call expression set from flow as flow actions and it can also be called as a screen action. In this example, we have setup a simple decision matrix which returns the discount percentage to apply based on the membership tier. The expression set is invoked from an autolaunched flow which in turn is called as a screen action to calculate the final amount. Attached are the screenshots.

Salesforce Fact #988 | Disable radio button on screen navigate

Image
Suppose we have a requirement that a radio button needs to be selected by the user in the current screen. Once the user moves previous/next from the current screen, it should get disabled. We can implement this using screen action and bit of condition logic. We can add condition to make sure the screen action autolaunched flow is called only once. And we can create a formula resource to check the InProgress and IsSuccess property of the action button which is used in the disabled attribute of the radio buttons. Attached are the screenshots.

Salesforce Fact #986 | Track first radio button select in screen flow

Image
Suppose we have a requirement to keep track of the first selected radio button in screen flow. For this, we can create an autolaunched flow and call it as a screen action. This flow will accept the first selected value and assign to a variable. We also need to set the action run condition in a way so that the subflow is called only once. In this example, we have a radio button with three values: Option1, Option2, Option3 and in the action run condition we have specified to call this flow till the currentValue resource is null. Attached are the screenshots.

Salesforce Fact #985 | Exit flow from any screen in screen flow

Image
Suppose we have a requirement to let the user exit from any of the screen in screen flow. We can use the FlowButtonBar component from UnofficialSF to implement this. However, if we want to go with the out of the box approach, here is how we can achieve it. We can create an LWC which will be embedded in each of the screens and will have an exit flow button. It will have an @api var which is set on click of confirmation from the user and sent back to the screen flow. Based on this value, we can add a decision check to find out whether user has opted to exit the flow and can route the user to the exit. Also, on confirmation from the user, we call the FlowNavigationNextEvent to proceed to the next element in the flow. One tricky thing is if the screen has outstanding validation errors then it won't move to the next screen. So, when the user opts for exiting the flow, we hide the existing inputs and then moves the user to the exit path. Attached are the screenshots.

Salesforce Fact #979 | Choice resource quick create in screen flow

Image
While setting choice resource in radio button or picklist input in screen flow, we can make use of the quick create feature. In the choice input, we can simply enter the name of the choice and select the 'Create Choice' option. In the backend , it will create a choice resource with the entered value. Attached are the screenshots.

Salesforce Fact #978 | Hide action button in screen flow

Image
We can hide the screen flow action button based on component visibility. Suppose we need to make sure the action button once clicked it should get hidden. It should be visible again once the user comes back from any previous or next screen. For this, we can define a boolean variable in the subflow and also make use of the InProgress attribute of the screen action. These two values can be used in component visibility to show/hide the button. At the start the boolean variable is null and the inProgress attribute is null if the action button has been called once and we come back to the screen from any previous/next screen. Attached is the screenshot.

Salesforce Fact #977 | Formatted label in screen flow input

Image
In some scenarios, we need to show the screen input element labels as formatted. For example, the label of a text input would be bold. For this, we can create a text template and put the formatted text and then refer this text template resource in the input label. Note: The extra <p> tags needs to be removed else the help text and required icons would get distorted. Attached are the screenshots.

Salesforce Fact #973 | Date/Time calculation in screen flow

Image
Suppose we have an input Date & Time element in the screen flow and after populating the input, we would like to perform some calculation by adding/subtracting hours and minutes. We can implement the logic using couple of screen elements and formula resource. Attached are the screenshots.

Salesforce Fact #961 | 1st monday and last friday validation in screen flow

Image
We can implement a validation in screen flow using the formula resource to select a date other than the first monday and last friday of the month. Attached are the screenshots.

Salesforce Fact #960 | 2nd or 4th saturday validation in screen flow

Image
We can implement a validation in screen flow using the formula resource to select a date other than the 2nd or 4th saturday of the month. Attached are the screenshots.

Salesforce Fact #951 | Sum of value of selected records in screen flow datatable

Image
Suppose we have a datatable in screen flow and we would like to show the sum of some numeric field of the selected records. We can use screen action and transform element to get the results. In this example, we are getting the sum of the Numberofemployees of the selected account records. Attached are the screenshots.

Salesforce Fact #935 | Get country prefix using screen action

Image
We can show the country prefix code with the help of screen action. In this example, we have created a custom metadata to store the country code and respective prefix value. Now, in the screen flow, on selecting a country picklist value we can pass the entire metadata list and the selected country value to a subflow in order to get the prefix and show the same in the screen instantaneously.  Attached are the screenshots.

Salesforce Fact #934 | Disabling picklist on selecting value in screen flow

Image
Suppose we have a scenario where we have a picklist in a screen flow and once a value is selected, the picklist should get disabled. We can implement it using screen action. In this example, we have a picklist with two values A and B in a screen flow. Whenever a value is selected, it is sent to an autolaunched flow and it returns a boolean value in response which is used in the disabled attribute of the picklist input. The catch is we need to create a formula resource to store the value of the selected picklist, directly passing it would always be received as null in the subflow. Attached are the screenshots.