cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

CDS Current Environment - Trigger Filter Expression with Lookup field

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

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Administrator
Administrator

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:

I hope this helps.

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

Thanks

Jay

View solution in original post

6 REPLIES 6
Highlighted
Administrator
Administrator

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:

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

Thanks

Jay

Highlighted
Helper I
Helper I

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

Highlighted
Administrator
Administrator

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.

Highlighted
Helper I
Helper I

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

Highlighted
Administrator
Administrator

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:

I hope this helps.

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

Thanks

Jay

View solution in original post

Highlighted
Helper I
Helper I

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

 

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (3,976)