PLAT-DEV-210 practice question 5 of 25

A developer needs to use the COUNTIF function to process data entered by the user in an OmniScript. The output of the function needs to be displayed to the user immediately in the current step. Based on best practice, which element should the developer use this function in?

Full set: 103 questions
Answer options
A: Set Values element
B: Formula element Correct answer
C: Range element
Correct Answer:
B. Formula element
Explanation

The Formula element is the best practice for this scenario as it is specifically designed to perform real-time, client-side calculations within an OmniScript step. It can evaluate functions like COUNTIF based on user input from other elements in the same step and display the result immediately without requiring a server roundtrip. This provides the instant feedback the user needs. The element's value updates dynamically as the user interacts with the OmniScript, fulfilling the requirement to display the output immediately in the current step.

Why Incorrect

A. Set Values element: This element is primarily used to manipulate the OmniScript's data JSON, often runs server-side by default, and is not designed for immediate UI display of a calculation's result.
C. Range element: This is a user input control, similar to a slider, used for selecting a value within a specified range. It does not execute functions or perform calculations.

References

1. Salesforce OmniStudio Documentation, "Formula Element": "Formula elements perform calculations in real time on the client side. The result of a calculation can be used in the OmniScript's data JSON. For example, a Formula element can calculate the sum of two Currency elements and display the result." This confirms its use for real-time, client-side calculations and display.

2. Salesforce OmniStudio Documentation, "OmniScript Functions Reference": The COUNTIF function is listed as a supported function that can be used within OmniScript elements like the Formula element to "count the number of items in a list that meet a specified criteria."

3. Salesforce OmniStudio Documentation, "Set Values Element": "The Set Values element enables you to set static values or values from a data source in the data JSON." This highlights its primary purpose as data manipulation, not immediate UI calculation and display.

Scroll to Top