Question
You are creating a cloud flow for an automation targeting Dataverse.
When a new account is created in Dataverse, the name of the account must be updated based on the following logic:
• If the Account Category Code equals Preferred Customer (1), pre append the value Preferred | to the name.
• If the Account Category Code equals Standard (2) or is not populated, pre-append Standard | to the name.
You need to define the correct formula to use for the automation.
Which formula should you use?
- A. if(equals(triggerOutputs()?['body/accountcategorycode'], 1), concat('Preferred | ', triggerOutputs()?['body/name']), concat('Standard | ', triggerOutputs()?['body/name'])) Correct
- B. if(equals(triggerOutputs()?['body/accountcategorycode'], 2), concat('Standard | ', triggerOutputs()?['body/name']), concat('Preferred | ', triggerOutputs()?['body/name']))
- C. if(equals(outputs('trigger')?['body/accountcategorycode'], 1), concat('Standard | ', outputs('trigger')?['body/name']), concat('Preferred | ', outputs('trigger')?['body/name']))
- D. if(equals(outputs('trigger')?['body/accountcategorycode'], 2), concat('Standard | ', outputs('trigger')?['body/name']), concat('Preferred | ', outputs('trigger')?['body/name']))
Explanation
Trigger values in a cloud flow are read with triggerOutputs()?['body/<column>'], not outputs('trigger'), which rules out C and D. Option A tests whether accountcategorycode equals 1 (Preferred Customer) and prepends 'Preferred | ' in that case; every other case, including Standard (2) and an empty value, falls to the else branch and prepends 'Standard | '. Option B tests for 2, so an empty category would wrongly get 'Preferred | '.