Posts

Showing posts with the label FormulaEvalInApex

Salesforce Fact #876 | PICKLISTCOUNT() in FormulaEvalInApex

Image
While using the PICKLISTCOUNT() function in the FormulaEvalInApex feature, it counts the number of semicolons unlike the PICKLISTCOUNT() function in the formula which returns the number of selected values in the multi-select picklist. So, we need to be careful if we use  FormulaEvalInApex  feature with PICKLISTCOUNT(). Ideally the correct result is returned count+1. Attached is the screenshot.

Salesforce Fact #863 | Another POC using FormulaEvalInApex

Image
In order to fetch the currency conversion rate for a particular currency in Apex, we need to query CurrencyType or DatedConversionRate Sobject. We can make use of the FormulaEvalInApex feature to get the conversion rate using dynamic formula without the need of any SOQL. Attached is the screenshot.

Salesforce Fact #862 | POC with FormulaEvalInApex

Image
The FormulaEvalInApex feature is in developer preview. We can construct dynamic formula in apex using this feature. In this example, we have constructed a formula to return the day of week for an input date. Reference:  https://help.salesforce.com/s/articleView?id=release-notes.rn_apex_formulaeval.htm&release=248&type=5 Attached are the screenshots.