cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
delasco_jeffh
Level: Powered On

dynamics 365

I am quite new to Flow, so if the question warrants, please post links.

 

Goal: Create a flow, that uses a web request, to pass an email address, that is used to search for 1 or more Contacts in Dynamics CRM and then update a simple attribute to No/False.

 

I've got the web request going, but my odata filter for Dynamics CRM List Records is failing with 'Syntax error at position 22 in 'email eq jeffh@delasco.com'.

 

my odata filter is `email eq (icon:HttpRequest)Email`

 

The Contact objects have a field labeled 'Email', I've tried it with and without caps. but no joy.

Help?  I'm just trying to write a "unsub" flow so we can update our CRM data in response to user requests for our site.

 

Also, I've been reading through a number of examples but I am in the weeds not using a template.  Where can I find resources on writing and testing ODATA filters on Dynamics 365 CRM data?  Is there an on-line tool to test ODATA queries prior to trying to create a flow action?

 

Also, where do I find docs on CRM specific functions for use with ODATA?  I've seen some crazy cool things but no references to docs on where I can find out more or read in more detail than what the example demos?

1 ACCEPTED SOLUTION

Accepted Solutions
delasco_jeffh
Level: Powered On

Re: dynamics 365

Kris,

 

Apologies -- I did not dig far enough before to see that "Contact" was under (List records ... See more).

Once I started to dig in there, I found Contact.   My flow is working as I expected.   

 

Thank you - Thank You.Screenshot - 02062018 - 10_46_36 AM.png

View solution in original post

3 REPLIES 3
Community Support Team
Community Support Team

Re: dynamics 365

HI @delasco_jeffh,

 

Could you please share a screenshot of your flow's configuration?

Do you want to filter records based on OData query within Filter Query field of "List records" action?

 

The error message told that there is something wrong with your OData query within Filter Query field of "List records" action, please check if there are some syntax errors with your OData query.

 

I think there is something wrong with the 'email' column of your OData query, the result that the "List records" action returned doesn't contain the email property, it only contains emailaddress1 property, emailaddress2 property, etc. You could get all properties of one record with "Get record" action or "List records" action within your flow.

 

I have made a test on my side and please take a try with the following workaround:

  • Add a HTTP Request trigger -- "When a HTTP reqauest is received" trigger, Request Body JSON Schema set to following schema:
{
    "type": "object",
    "properties": {
        "EmailAddress": {
            "type": "string"
        },
        "Department": {
            "type": "string"
        }
    }
}
  • Add a "List records" action, specify Organization Name, Entity Name set to Contacts, Filter Query field set to following formula:
emailaddress1 eq 'EmailAddress dynamic content of the trigger'

7.JPG

Note: The EmailAddress dynamic content is wrapped with single quotes within Filter Query field of "List records" action.

 

  • Add a "Apply to each", input parameter set to output of "List records" action.
  • Within "Apply to each", add a "Update a record" action, specify Organization Name, Entity Name and Record identifier. Credit Hold field set to No.

 

Image reference:8.JPG

 

9.JPG

 

10.JPG

The flow works successfully as below:11.JPG

 

12.JPG

 

 

More details about OData query within Dynamics 365, please check the following article:

OData query in Dynamics 365

 

Best reagrds,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
delasco_jeffh
Level: Powered On

Re: dynamics 365

Kris,

Thanks for the assist.  Using emailaddress1 and placing single quotes around the placeholder fixed my filter.

 

Now, I am experiencing a "BadRequest"  during the (Update a record)

 

Screenshot - 02062018 - 10_46_36 AM.png

In my view, for Record Identifier, I am limited to "Current Item" and don't have "Contact" as you do in your screenshot.

The list records finds the two matching contacts and loops over them but fails to complete the update of "Do not allow bulk emails"

Screenshot - 02062018 - 10_56_23 AM.png

 

Screenshot - 02062018 - 10_58_24 AM.pngScreenshot - 02062018 - 10_58_55 AM.png

Thanks for your help.

delasco_jeffh
Level: Powered On

Re: dynamics 365

Kris,

 

Apologies -- I did not dig far enough before to see that "Contact" was under (List records ... See more).

Once I started to dig in there, I found Contact.   My flow is working as I expected.   

 

Thank you - Thank You.Screenshot - 02062018 - 10_46_36 AM.png

View solution in original post

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons in April

Read the announcement for more information!

firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

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
Top Kudoed Authors
Users online (3,672)