Hi,
As per our understanding, you've encountered an issue with setting a choice (option set) by text in Power Automate.
Let's consider your scenario where you have a text field in the opportunity entity, and you want to set the option set field based on this text field.
The forecast category is an option set, and you can use the following expression to map the text field to the corresponding option set value:
Use the below expression :-
if(
empty(triggerOutputs()?['body/cre80_forecast']),
null,
if(
equals(triggerOutputs()?['body/cre80_forecast'], 'Pipeline'),
100000001,
if(
equals(triggerOutputs()?['body/cre80_forecast'], 'Best case'),
100000002,
if(
equals(triggerOutputs()?['body/cre80_forecast'], 'Committed'),
100000003,
if(
equals(triggerOutputs()?['body/cre80_forecast'], 'Omitted'),
100000004,
if(
equals(triggerOutputs()?['body/cre80_forecast'], 'Won'),
100000005,
if(
equals(triggerOutputs()?['body/cre80_forecast'], 'Lost'),
100000006,
null
)
)
)
)
)
)
)
This expression checks the value of the cre80_forecast field and maps it to the corresponding option set value. If the text field is empty, it returns null. Otherwise, it assigns the appropriate value based on the text.
Hope this helps.
Thanks!