Welcome to our blog where will be sharing tip, tricks and detailed walk-throughs covering all areas of Dynamics 365 but primarily focused on the Field Service and Project Service Apps, Scheduling and integration using Microsoft Flow and the Common Data Service (CDS). We hope you find the blog posts useful and please feel free to comment if you would like us to elaborate on any particular area. 

Setting Lookup values in the new Flow CDS connector

There are 2 different CDS connectors currently available, one of which can only be used when the Flow is being created with in a solution on the Power Platform (see my other blog here for more information on this). This version is more feature rich than the other CDS connector but does have a few idiosyncrasies which could catch people out if they're used to the way the other CDS connector works. One of these is the setting of a lookup value (entity reference) on a Create/Update operation. In the prior version of the connector you could just use the unique id (GUID) of the entity you wish to set and all would work fine, however in the latest connector this isn't the case.


When you select a Trigger or Action and search on Common Data Service, the new connector is the second one that is displayed labelled, Common Data Service (current environment)

In this simple example, when a Contact is created I'm going to automatically create an Account for that Contact and set the Primary Contact on that Account to the created contact. I used to just be able to select the Contact id from the Dynamic Content (from the Create trigger) and drop into the Primary Contact lookup field on the creation of the account as shown below and it would all work.

However, if you do this in the new connector you get "Resource Not Found For Segment" error when the Flow is executed.

The way to resolve this is by using the format as you would if you were setting the single-valued navigation property using the @odata.bind annotation. (see Associate Entities on create in this page https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/webapi/create-entity-web-api as an example). The format is a "/" followed by the entities plural name e.g. contacts in our case, followed by the unique id wrapped in parentheses. So as an example, /contacts(00000000-0000-0000-0000-000000000001). So, I amended my Flow as shown below:

And re-executed using another one of my favourite Flow features, Test Flow using data from a previous run. In this case, the one that had previously failed.

And, hey presto, it now all works perfectly.



2,748 views0 comments