web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

CDS Current Environment - Trigger Filter Expression with Lookup field

(0) ShareShare
ReportReport
Posted on by 8

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...

 

 

I have the same question (0)
  • Suggested answer
    JayBuddhdevtest Profile Picture
    275 on at

    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

  • Power Platform Communities Profile Picture
    8 on at

    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

  • MSTGuy Profile Picture
    310 on at

    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.

  • Power Platform Communities Profile Picture
    8 on at

    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

  • Suggested answer
    JayBuddhdevtest Profile Picture
    275 on at

    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

  • Power Platform Communities Profile Picture
    8 on at

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

     

    Appreciated

     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 45 Most Valuable Professional

#2
iampranjal Profile Picture

iampranjal 36

#3
Satyam Prakash Profile Picture

Satyam Prakash 31

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans