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

unable to make filter query for list records

My app has the three entities Pharmacy_Contact, Pharmacy_History, and Pharmacy_Action. When a history record has been created or updated I need to cycle through all history records for the contact, get the action record associated with the history record, then finally update a status in the contact record with a computed value. In list records I'm unable to construct the filter query correctly. The schema name for the field is dhs_Contact and the display name is Contact. It is a look up field. In the dynamic content list the history fields are enumerated. I assume I should choose Contact and have it place that in filter query, follow with eq, then whatever value is passed from the trigger event. I can't figure out how to get the value to put after eq. All history records returned will have the same contact value, and, it will be the same contact value of the history record changed by the user. See attached screen snapshot.

1 ACCEPTED SOLUTION

Accepted Solutions
dmcdivitt Resolver I
Resolver I

Re: unable to make filter query for list records

The correct syntax for Filter Query in the List Records control is:

       dhs_Contact/dhs_pharmacycontactid eq (Contact from Dynamic Content)

 

This will create a list of all Pharmacy_History records having the same Pharmacy_Contact as the history record updated or created.

The forward slash allows a field within the entity record to be specified, and dhs_pharmacycontactid is the name of the field.

View solution in original post

5 REPLIES 5
Community Support
Community Support

Re: unable to make filter query for list records

Hi @dmcdivitt,

 

Dynamic content Contact is a unique identifier of the Contact, it will return a GUID but not a specific name.

To know the extract return value of a dynamic content, please try to use Compose action.

I have made the following test, I am going to filter records that the firstname is “Vincent”. Please check the following screenshot for a reference.

1.PNG2.PNG

Besides, more details about Odata Filter query, please check the following doc for a reference:

https://docs.microsoft.com/en-us/previous-versions/dynamicsnav-2016/hh169248(v=nav.90)

 

Best regards,

Mabel

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
dmcdivitt Resolver I
Resolver I

Re: unable to make filter query for list records

Mabel,

 

Thanks for replying. I agree the Dynamic Content contact value is a GUID. Information in Dynamic Content is passed from the triggering event. What I need to know is how to compare that with values contained in history records. I need to know what to place in the filter query text box for the list records control.  The flow is triggered when editing a history record, which means information for that history record is present in Dynamic Content. I need to find all history records having the same contact value.

I'm not able to read the screen snapshot you posted even after saving the image and zooming in.

Community Support
Community Support

Re: unable to make filter query for list records

Hi @dmcdivitt,

 

Are you working with dynamic 365 histories entity?

The screenshot I provided is:

1.PNG

 

 

Best regards,

Mabel

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
dmcdivitt Resolver I
Resolver I

Re: unable to make filter query for list records

Thanks for the effort, Mabel. It is appreciated. Pharmacy History and Pharmacy Contact are custom entities. The field dhs_Contact is a lookup field in Pharmacy History saying what Pharmacy Contact the history record belongs to, and contains a GUID. The display name is Contact. The name field is not used in Pharmacy History.

The flow is triggered by a Pharmacy History update. Because of that, the Pharmacy History record just updated is present in Dynamic Content values  I want to find all histories having the same contact, so, for the filter query in the list records control, I need something like:

           dhs_Contact eq (Contact from Dynamic Content)

I have done trial and error and can see the GUID value for (Contact from Dynamic Content) as a string value in the error message displayed when the flow fails. An error similar to the following occurs:

A binary operator with incompatible types was detected. Found operand types 'Edm.Guid' and 'Microsoft.Dynamics.CRM.dhs_pharmacycontact' for operator kind 'Equal'.

dmcdivitt Resolver I
Resolver I

Re: unable to make filter query for list records

The correct syntax for Filter Query in the List Records control is:

       dhs_Contact/dhs_pharmacycontactid eq (Contact from Dynamic Content)

 

This will create a list of all Pharmacy_History records having the same Pharmacy_Contact as the history record updated or created.

The forward slash allows a field within the entity record to be specified, and dhs_pharmacycontactid is the name of the field.

View solution in original post

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

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!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (6,407)