Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

CDS Current Environment - Trigger Filter Expression with Lookup field

Posted on by 3,962

So I have a flow that I want it to only run when the lookup field currency (transactioncurrencyid) is equal to USD.

 

It works fine when I use the "_transactioncurrencyid_value eq {GUID}" in the Filter expression.

Where GUID is the USD currency record GUID.

 

Clearly we will have an issue here, that is if I take the flow into another environment or if the currency data every gets recreated... the GUID will change and then the Flow will not get triggered until I update the Filter Expression.

 

Currently what I have done is instead of using the filter expression and I am using the "Get Record" in order to check the selected currency is in fact USD. Otherwise, don't do anything...

 

But still I wonder, if it is even possible test a lookup field text instead of the GUID in the Trigger Filter Expression...

 

 

  • RE: CDS Current Environment - Trigger Filter Expression with Lookup field

    Thanks for the confirmation re it is not possible to do such thing on the Trigger itself...

     

    Appreciated

     

  • Suggested answer
    JayBuddhdevtest Profile Picture
    JayBuddhdevtest 275 on at
    RE: CDS Current Environment - Trigger Filter Expression with Lookup field

    Hi Xun,

    In what step are you trying to add the filter expression as a text GUID? If it is in first step then no it is not possible to add the text value in the filter expression, but if it is in the second step or a later step, you can add a step to get record and from there.

    There is one other way, which requires little bit of customization and a additional flow. Here are the details on this.

    1. Create a custom field in the targeted entity

    2. Create a Automated blank flow, with a trigger when a record is created. Select targeted entity, and environment.

    3. Add a step "Get records", to get the currency name.

    4. Add a step "Update record", select the targeted entity, add unique identifier and now in the custom field you created add the currency name value from the above step.

    I did a test for you, and it seems to be working fine. Now you need to change the filter query to the above custom field in your original flow. Here is the snapshot of the flow:

    Screen-Shot-2020_2D00_07_2D00_05-at-12.47.39-PM.png

    Screen-Shot-2020_2D00_07_2D00_05-at-12.48.37-PM.png

    I hope this helps.

    Please let me know if you have any questions/concerns. I am always happy to help.

    Thanks

    Jay

  • RE: CDS Current Environment - Trigger Filter Expression with Lookup field

    Thanks again for giving the details with extra action steps by using Parse Json ...

     

    So in the other word it is Not Possible to filter use the Filter Expression on the Trigger itself by a lookup field text instead of the value,

    Correct?

     

    If you confirm the above for me that would be brilliant.

    Many thanks adv

  • MSTGuy Profile Picture
    MSTGuy 310 on at
    RE: CDS Current Environment - Trigger Filter Expression with Lookup field

    You would have to create a step to Parse Json and get the value of the label, you can then use the variable from there. I have used it multiple times, and it was working fine. I have just created a test for you:

    1. Run the flow once and get the body value from the sample run:

    2. Edit the flow, add a step to Parse Json. Select Body as the content, in scheme click on Generate it from Sample, and then paste the sample that you copied earlier:

    3. Now in next step you should be able to see the variable from the above step with a name like _variablename_label:

    Note:- If you don't want too many variable you can just add a sample data of the targeted variable in generating the schema.

  • RE: CDS Current Environment - Trigger Filter Expression with Lookup field

    Jay,

    Thanks.

    Sorry if I wasn't clear enough in my initial post, but what I am really after here is if it's possible to test the text value of the lookup field directly in the Filter Expression instead so the Flow will not get trigger at all. 

    Any ideas?

    Xun

  • Suggested answer
    JayBuddhdevtest Profile Picture
    JayBuddhdevtest 275 on at
    RE: CDS Current Environment - Trigger Filter Expression with Lookup field

    Hi,

    You can add a step to Parse JSON and then you can get the GUID of the currency. More details on how to parse Json from the above body step could be found in this answer. I also did a test for you and found the GUID of the currency without any problem:

    pastedimage1593709084424v1.png

    I hope this helps. Please let me know if you have any questions/concerns.

    Thanks

    Jay

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans