How to find a customer in Dynamics 365 for Finance and Operations only for example by the email address of an incoming email.
With flow and the action “get records” it is very easy.
The first step after for example a trigger like “When an email arrives” is an action called “Get Records”. Please be aware to select the connector to Dynamics 365 for Finance and Operations because the following describes only the steps for this connector.
After adding the action you have to select the instance in which your contacts and customers are maintained.
In the entity name field select the entity “ContactPersons” because we need to find the right contact to the email address.
To get this work the filter has to be defined in the field Filter Query.
There we have to enter the field of the D365FO Entity where the email addresses are inserted. This field is called “PrimaryEmailAddress. To get the correct contact we have to enter:
PrimaryEmailAddress eq ‘emailaddress‘
- eq stands for equal
- Emailaddress can be a fixed entry or can be for example the From field from the trigger “When an email arrives”.
Now we have as a result the correct contact but not the customer. To find the customer we a second action. This is the same action type as above.
When we insert the action as the second step we get an apply to each because theoretical it is possible that we get more than 1 results from the first step.
In the instance field we have to select the same instance we have selected in the first step.
Now we need another Entity Name as in step 1. Here we need the Entity Customers.
To find the right customer we will use the field associated party number from the ContactPersons entity to compare with the PartyNumber field from the entity Customers.
See the screenshots in the field Filter Query the needed phrase.