cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helpful
Responsive Resident
Responsive Resident

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

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
v-zhos-msft
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.

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.

Oswin
Advocate I
Advocate I

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

Helpful
Responsive Resident
Responsive Resident

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.

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

----------------------------------------------
Check out my Project Operations and Power Automate blog at:
https://daytodaydynamics365.com

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.

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. 

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. 

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

Hi, 

I am also facing issue while creating Project task record.

Screenshot_11.png

Thanks in advanced.

 

zz
Regular Visitor

Try the expression

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

DennisM
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')"
    }
}
 

 

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

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
Responsive Resident
Responsive Resident

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

Celebrating the May Super User of the Month: Laurens Martens

  @LaurensM  is an exceptional contributor to the Power Platform Community. Super Users like Laurens inspire others through their example, encouragement, and active participation. We are excited to celebrated Laurens as our Super User of the Month for May 2024.   Consistent Engagement:  He consistently engages with the community by answering forum questions, sharing insights, and providing solutions. Laurens dedication helps other users find answers and overcome challenges.   Community Expertise: As a Super User, Laurens plays a crucial role in maintaining a knowledge sharing environment. Always ensuring a positive experience for everyone.   Leadership: He shares valuable insights on community growth, engagement, and future trends. Their contributions help shape the Power Platform Community.   Congratulations, Laurens Martens, for your outstanding work! Keep inspiring others and making a difference in the community!   Keep up the fantastic work!        

Check out the Copilot Studio Cookbook today!

We are excited to announce our new Copilot Cookbook Gallery in the Copilot Studio Community. We can't wait for you to share your expertise and your experience!    Join us for an amazing opportunity where you'll be one of the first to contribute to the Copilot Cookbook—your ultimate guide to mastering Microsoft Copilot. Whether you're seeking inspiration or grappling with a challenge while crafting apps, you probably already know that Copilot Cookbook is your reliable assistant, offering a wealth of tips and tricks at your fingertips--and we want you to add your expertise. What can you "cook" up?   Click this link to get started: https://aka.ms/CS_Copilot_Cookbook_Gallery   Don't miss out on this exclusive opportunity to be one of the first in the Community to share your app creation journey with Copilot. We'll be announcing a Cookbook Challenge very soon and want to make sure you one of the first "cooks" in the kitchen.   Don't miss your moment--start submitting in the Copilot Cookbook Gallery today!     Thank you,  Engagement Team

Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!    

Welcome to the Power Automate Community

You are now a part of a fast-growing vibrant group of peers and industry experts who are here to network, share knowledge, and even have a little fun.   Now that you are a member, you can enjoy the following resources:   Welcome to the Community   News & Announcements: The is your place to get all the latest news around community events and announcements. This is where we share with the community what is going on and how to participate.  Be sure to subscribe to this board and not miss an announcement.   Get Help with Power Automate Forums: If you're looking for support with any part of Power Automate, our forums are the place to go. From General Power Automate forums to Using Connectors, Building Flows and Using Flows.  You will find thousands of technical professionals, and Super Users with years of experience who are ready and eager to answer your questions. You now have the ability to post, reply and give "kudos" on the Power Automate community forums. Make sure you conduct a quick search before creating a new post because your question may have already been asked and answered. Galleries: The galleries are full of content and can assist you with information on creating a flow in our Webinars and Video Gallery, and the ability to share the flows you have created in the Power Automate Cookbook.  Stay connected with the Community Connections & How-To Videos from the Microsoft Community Team. Check out the awesome content being shared there today.   Power Automate Community Blog: Over the years, more than 700 Power Automate Community Blog articles have been written and published by our thriving community. Our community members have learned some excellent tips and have keen insights on the future of process automation. In the Power Automate Community Blog, you can read the latest Power Automate-related posts from our community blog authors around the world. Let us know if you'd like to become an author and contribute your own writing — everything Power Automate-related is welcome.   Community Support: Check out and learn more about Using the Community for tips & tricks. Let us know in the Community Feedback  board if you have any questions or comments about your community experience. Again, we are so excited to welcome you to the Microsoft Power Automate community family. Whether you are brand new to the world of process automation or you are a seasoned Power Automate veteran - our goal is to shape the community to be your 'go to' for support, networking, education, inspiration and encouragement as we enjoy this adventure together.     Power Automate Community Team

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

Tuesday Tip | How to Report Spam in Our Community

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   Today's Tip: How to Report Spam in Our Community We strive to maintain a professional and helpful community, and part of that effort involves keeping our platform free of spam. If you encounter a post that you believe is spam, please follow these steps to report it: Locate the Post: Find the post in question within the community.Kebab Menu: Click on the "Kebab" menu | 3 Dots, on the top right of the post.Report Inappropriate Content: Select "Report Inappropriate Content" from the menu.Submit Report: Fill out any necessary details on the form and submit your report.   Our community team will review the report and take appropriate action to ensure our community remains a valuable resource for everyone.   Thank you for helping us keep the community clean and useful!

Users online (4,990)