It may happen when using CRM dialogs that you get a requirement whereby on a “Prompt and Response” step the client wants the message to display the value in one attribute only if populated; otherwise to display a different field value.
This is a common scenario when using dialogs but thought I would share how this works using a basic example. In code this is similar to how a “inline If” statement could work valueToDisplay = IIF(email1=null ? email2 : email1). Essentially we test to see if the first email address field is null if that returns true then display the alternate email address otherwise the first. This is an over simplistic example as you would not normally expect a NULL in a string value but lets go with it for illustration.
Simple Contact Dialog
We have a dialog that can be run on demand against a Contact record. Its purpose is to collect key fields like email address and prompts the user with the email address it is using at the moment. This of course depends on what data is available but Email (primary) is the Preference.
Setting the dialog condition (order of precedence)
The order in which fields appear sequentially on the list will determine which field value is displayed to the user. In this example, we have two attributes, though we could have had more. The email field is preferred over the secondary email address.
As we have a value for email it has correctly displayed this value. What happens if we now go back into the contact record and delete that value?