Posts

Showing posts with the label picklist

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.

Salesforce Fact #910 | Picklist Contains operator in flow Get Records with translation

Image
Similar to apex, we need to be careful while using Contains operator in flow along with picklist translation. In this example, we have added the french translation for the Account Industry picklist value 'Banking'. Now, while using Contains operator on the Industry picklist in Get Records element, it works fine for English language but does not work for French language. No records are fetched in the Get Records for french user. To resolve this, we need to remove the Contains check from the Get Records and check the same by adding a decision element afterwards. Attached are the screenshots.

Salesforce Fact #833 | SOQL LIKE operator limitation on picklist values

Image
We need to be careful while using the SOQL LIKE operator on picklist values. While using LIKE operator, it considers the translated label instead of the API name of that value. In this example, we have added the translation for the account industry 'Banking' for french language. Now, when the user language is english the LIKE operator works as expected but when the user language is french, the SOQL query does not return any result. Reference:  https://salesforce.stackexchange.com/questions/285076/why-does-the-like-soql-operator-implicitly-translate-picklist-values Attached are the screenshots.

Salesforce Fact #803 | Add translations for standard country/state picklists

How to add the translation for the standard country and state picklist values? We can use Translation Workbench to add the translations. Steps: Setup -> Translate -> Choose the language -> In setup component, select Address Country or Address State -> Add the translations.

Salesforce Fact #767 | INCLUDES() and PICKLISTCOUNT() combo

Image
Suppose we have a scenario where we need to check for a specific value of a multi-select picklist field in the validation rule. Now, since multi-select picklist can be checked with INCLUDES() only, it checks as per the contains logic, not for the specific value. We can make use of the PICKLISTCOUNT() function to ensure it checks only for that specific value. In this example, we have a multi-select picklist field in Account which has 3 values: A,B,C. Now, we want to create a validation rule so that when the account rating is 'Hot', the selected value should be 'A'. Attached is the screenshot.

Salesforce Fact #714 | Error while deactivating picklist value

Have you encountered this error while deactivating a picklist value 'The picklist value you attempted to delete is the last value for the following record types'. In order to avoid the error, we need to go to the particular record type and the picklist field, then move the value from the 'Selected Values' section to 'Available Values' section and ensure there is at least one other value is selected. Now, we are good to deactivate the picklist value. Reference:  https://help.salesforce.com/s/articleView?id=000386677&type=1

Salesforce Fact #705 | Disabling few picklist values in LWC

Image
Suppose we need to make some of the picklist values as disabled in LWC. Now, the individual options of lightning-combobox doesn't support any disabled attribute. So, we can implement the same using slds and iteration logic. In this example, we have 3 options and option2 is disabled. Attached are the screenshots.

Salesforce Fact #668 | Country, State picklist in screen flow

Image
We can show the standard country and state picklist values in screen flow using the Dependent picklist type input. The controlling picklist is the country field and the api name would be the country code for eg. ShippingCountryCode. The dependent picklist is the state field and api name would be the state code for eg. ShippingStateCode. This dependency can be specified till 3 picklists. In order to get the selected picklist values, the top, middle and bottom attributes i.e. topPicklistApiName, topLabel, topRequired, topValue are used. Reference:  https://help.salesforce.com/s/articleView?id=sf.flow_ref_elements_screencmp_dependentpicklists.htm&type=5 Attached are the screenshots.

Salesforce Fact #666 | Picklist api value with single quote

Image
Suppose we have a picklist field value whose api name contains single quote like the value: Partner's Account. In order to import the data correctly in this field, we need to wrap the value inside double quotes like "Partner's Account". Attached are the screenshots.

Salesforce Fact #567 | Display picklist based on record type in screen flow

Image
Now we can filter out picklist values based on record type in screen flows. We can use record variable and set the RecordTypeId field with the corresponding id and use the same record variable in the screen and the picklist values will appear accordingly. In this example, we have two record types on account: Test_RT1 & Test_RT2. The rating picklist values are respectively Hot, Warm and Cold. The same appears in the screen flow. Reference:  https://help.salesforce.com/s/articleView?id=release-notes.rn_automate_flow_builder_filter_picklists_by_record_type.htm&type=5&release=240 Attached are the screenshots. Note: do not use hardcoded ids. it is only for demonstration purpose.