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

Problem with Create a new record from Common Data Service (current environment) connector

Hi All,

I was trying to use the Create a new record action from the new connector and am getting an error whenever trying to add a relationship value.

For example, when adding a new Expense that has a lookup field to Currency.  When I supply the CurrencyId (GUID) to the field of the Expense I get an error:

"code": "0x0",
"message": "Resource not found for the segment '[MY_GUID]'.",

Where [MY_GUID] is the actual Id.  This happens for every type of field that is a relationship.  If I use the old Common Data Service "Create a new record" action it works just fine.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Regular Visitor

After some investigation of what's going on behind the scenes in comparison to the regular Common Data Service connector I saw that previously 

"item/_transactioncurrencyid_value" : "YOUR_GUID"

was used to populate the lookup in the API call, this requiring only the GUID of the currency to be filled in as a parameter in Flow. Now with the current environment this changed to

"item/TransactionCurrencyId@odata.bind": "/transactioncurrencies(YOUR_GUID)"

Sadly, at the moment the "/transactioncurrencies(" and ")" are not added to the API call when you simple add a GUID field as parameter for your action. So, the solution for now (expecting this to be solved as a bug soon), is to manually add these two parts in your lookup field to make the API call valid.

currency.PNG

View solution in original post

15 REPLIES 15
Highlighted
Solution Sage
Solution Sage

Hi @Helpful ,

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

As you said when you Created a new record with the new connection, the error occurred.

So please make sure the new connection has the permission to the entity you want.

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Highlighted

Thanks, @v-zhos-msft,

I have since reconfigured to use the existing CDS "Create a new record" action.  In my post I was referring to the new CDS connector called "Common Data Service (current environment)".  Announced here:  https://us.flow.microsoft.com/en-us/connectors/shared_commondataserviceforapps/?slug=common-data-ser...

I used that connector for the Trigger event, as well as a Get record action in the Flow, however, when it came time to Create a record it got wierd.

I'm not going to spend too much time on it because the info seems pretty limited.  Even the documentation link in that anouncement goes to a 404 page.

Highlighted
Regular Visitor

After some investigation of what's going on behind the scenes in comparison to the regular Common Data Service connector I saw that previously 

"item/_transactioncurrencyid_value" : "YOUR_GUID"

was used to populate the lookup in the API call, this requiring only the GUID of the currency to be filled in as a parameter in Flow. Now with the current environment this changed to

"item/TransactionCurrencyId@odata.bind": "/transactioncurrencies(YOUR_GUID)"

Sadly, at the moment the "/transactioncurrencies(" and ")" are not added to the API call when you simple add a GUID field as parameter for your action. So, the solution for now (expecting this to be solved as a bug soon), is to manually add these two parts in your lookup field to make the API call valid.

currency.PNG

View solution in original post

Highlighted

Bravo!  Just got back from vacation, tried this and it works as you spec'd.

Sadly, this means my Create action will break as soon as the bug is fixed, but this gets me using a single connection type for the flow.  Much appreciated.

Highlighted

I'm chiming in on this thread as I've been going over the issue myself, with other MVPs and with the product team. This is currently by design. The CDS (current environemnt) connector expects the referenced attribute values in the form of OData id (entity-name(record-id)).

 

I realize digging for the entity names may sometimes be a bit of work, especially as core CE, PSA and FS have differences in how entities are named. There is a way to dig out an entity name from a "Get records" action to hopefully help with this a bit. I'm working on a post around this and will update this thread with a link in the near future.

Edit:
https://daytodaydynamics365.com/referencing-records-when-using-the-common-data-service-current-envir...

Highlighted

Thanks for the video. It was really helpful. 

 

So the MS product team confirmed that the annoying additional step to create a compose is by design and they won't be changing it? 

 

That's a bit disappointing since I was looking forward to using the new CDS connector but this one area seems to be a downgrade.

Highlighted

This "feature" makes the connector unusable for us.  We have flows where we reference 10 other records or more.  Now, when the referenced GUID is blank on a particular record, instead of writing a null value in the flow with all other steps executing properly,  the flow fails because the syntax is incorrect for that one null value.   We've spent quite a bit of time trying workaround expressions- "if(empty(outputs....." and have been unable to make anything work. 

Highlighted

I completely agree. It's really stupid. There are times where I might not have a GUID value for that specific field but I'm forced to add in the entity reference. 

Highlighted

This was raised as an issue. Please up vote for quicker resolution.

 

Allow-Setting-null-value-to-the-lookup-field-in-Common-Data 

 

Regards

Pavan

Highlighted

Hi, 

I am also facing issue while creating Project task record.

Screenshot_11.png

Thanks in advanced.

 

Highlighted
Regular Visitor

Try the expression

concat('projects(',triggerOutputs()?['body/_msdyn_project_value'], ')')

Highlighted
Regular Visitor

I have a problem creating a new record in that the contact GUID that I pass is not being accepted. I get this error: Resource not found for the segment '6a93486d-9809-eb11-a813-000d3a569ac4'. I know the GUID is correct because I can paste in a URL and it loads the correct Contact in Dynamics.  Here is a peak at the source in the Create Record Action: 

{
    "inputs": {
        "host": {
            "connectionName""shared_commondataserviceforapps",
            "operationId""CreateRecord",
            "apiId""/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps"
        },
        "parameters": {
            "entityName""incidents",
            "item/title""@{triggerBody()['text']} @{triggerBody()['text_1']}",
            "item/casetypecode"2,
            "item/primarycontactid@odata.bind""@items('Apply_to_each')?['contactid']",
            "item/customerid_contact@odata.bind""@items('Apply_to_each')?['contactid']"
        },
        "authentication""@parameters('$authentication')"
    }
}
 

 

Highlighted

With the new connector, the required syntax is ‘Contacts(GUID)’

just sending the GUID won’t work, you need to add the plural schema name of the entity plus () with the GUID inside

Highlighted

Thankyou Captjoemcd

 

I made the change to use 'Contacts(@{items('Apply_to_each')?['contactid']})' but I get this error -> Bad Request - Error in query syntax.

 

But contacts(@{items('Apply_to_each')?['contactid']}) works, so it appears case sensitive. ie contacts(GUID) works

 

Thanks much for your help.

 

Highlighted
Resolver III
Resolver III

Still working with this as designed and still not liking it.

I'm sure there's a good reason for putting Flow authors through these extra steps, but it's not clear what it is from an outside perspective.

Take an example of using a Flow to copy a record.  It involves creating a new record with potentially several relationships that may or may not have values.

Each relationship field on the new record has to have an expression (to determine if it exists) that includes the relationship prefix and the funky '_value' string... kind of a mess for a very common scenario.

I'm sure everyone has their syntax for the expression that handles empty relationship values figured out, but thought I'd add it to the thread.  Below is an example of an expression added to a relationship field of of a "Create new record" action where I'm looping through records and creating copy of each one.

 

 

if(empty(items('For_each_Child_Record')?['_xyz_relatedrecordid_value']), '', concat('/relatedrecords(',items('For_each_Child_Record')?['_xyz_relatedrecordid_value'],')'))

 

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Kudoed Authors
Users online (7,788)