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

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

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

14 REPLIES 14
Highlighted
Solution Sage
Solution Sage

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

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
Resolver III
Resolver III

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

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

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

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
Resolver III
Resolver III

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

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

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

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
Helper III
Helper III

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

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
Frequent Visitor

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

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
Helper III
Helper III

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

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
Advocate I
Advocate I

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

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
Helper I
Helper I

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

Hi, 

I am also facing issue while creating Project task record.

Screenshot_11.png

Thanks in advanced.

 

Highlighted
Regular Visitor

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

Try the expression

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

Highlighted
New Member

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

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
Frequent Visitor

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

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
New Member

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

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.

 

Helpful resources

Announcements
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.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Top Solution Authors
Users online (8,701)