Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
Answered

Initialize Variable for Choice Field Not Working in Power Automate

Posted on by 70

Hi,

I have a Choice field named 'Application Type', and when that field is modified, I want to trigger an action. So for that I used the trigger 'When a row is modified', and then I Initialized Variable for that choice field as follows (please refer screenshots)...

PowerUser06_5F00_1_2D00_1663627668186.png

Then I applied a condition on that Initialized Variable...

 PowerUser06_5F00_2_2D00_1663627765125.png

So if the value of the Choice field is a particular value, I want to trigger an action, but whether the value is equal to my chosen value or not, the result of the condition is always returning 'false', and the 'If no' action is the one that is always being triggered. 

Can someone please tell me what is wrong with my condition?

Thanks!

  • Suggested answer
    D365 User 06 Profile Picture
    D365 User 06 70 on at
    RE: Initialize Variable for Choice Field Not Working in Power Automate

       

    You are right, I put quotes around the number value in the Condition and now my flow is working!

    pastedimage1663733872346v1.png

    Thanks a lot, Leah!!

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Initialize Variable for Choice Field Not Working in Power Automate

    Hi Partner,

    Yes, the values are all correct, it is only the type inconsistency that causes this.

  • D365 User 06 Profile Picture
    D365 User 06 70 on at
    RE: Initialize Variable for Choice Field Not Working in Power Automate

    @ Leah Ju

    Thank you for your response. The actual options in the 'Application Type' field are strings, i.e., 'New', 'Renewal', 'Resubmission', 'Extension', etc. So the actual options are strings, but the number I have used is the number value of these choice labels. This number represents the option 'Extension'. The flow run shows that the Trigger of my flow has captured both the values correctly. This is what is shown in the output...

    {

     "new_applicationtype": 248870003,

     "_new_applicationtype_label": "Extension"

    }

    Even the output of my action branch that ran after the condition returned false has captured the value and label correctly..

    {

    "aparnasw_applicationtype@OData.Community.Display.V1.FormattedValue": "Extension",

     "aparnasw_applicationtype": 248870003

    }

    So I am not able to figure out where the problem lies. Thank you for your help.

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Initialize Variable for Choice Field Not Working in Power Automate

    Hi Partner,

    In your example, Application Type is number but AppType is string. If you are trying to compare number type to string than the condition will never satisfied.

    Now, you can choose to modify the type of either of them to match:

    (1)Change Application Type value to string:

    --a. Using expression: string(24887003)

    pastedimage1663641719066v2.png

    --b. Adding double quotes to static value(24887003) directly

    pastedimage1663641474808v1.png

    (2)Change AppType variable:

    pastedimage1663642084781v3.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,554 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,588 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans