cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mdanielcristian
Regular Visitor

CDS REST save multiple rows in one call

Hello,

I'm using CDS to store data for a Teams Application. I have one scenario in which I need to save multiple rows in one call, about 300 rows so having to make a call for each of them is not an option.

I'm using the REST Web Api https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/webapi/create-entity-web-ap...

 

My application is a .NET Core Web application and I use a JWT Token added to each call in order to make all the calls as the current user.

Is there a way to achieve this using the REST Api? Or any other way to do in in a .NET Core app?

 

I read about the CrmServiceClient but that doesnt't work for .NET Core, and I also read about the CdsServiceClient, but this is in an Alpha release and it only supports server to server authentication.

 

Thanks,

Daniel

3 REPLIES 3
DavidJennaway
Solution Supplier
Solution Supplier

The only way to create multiple records in one call using the REST API is the deep insert concept, where you create a parent record and multiple child records. In some circumstances this is viable, even though you're often creating a dummy parent record. It is possible to setup a bulk deletion job to delete the dummy records.

The other option is to use the CrmServiceClient, which allows you to submit multiple requests in one call via the ExecuteMultiple method. However, as you've already noticed, the CrmServiceClient is not (yet) supported in .Net Core, and only works in .Net.

Theoretically there's a 3rd option, to use the SOAP endpoint, which also supports ExecuteMultiple , but this will soon be deprecated, and you'd probably need a fair bit of code to handle the authentication if you're using .Net Core, so I wouldn't recommend this

Thanks for the tips, I didn't know about the deep insert concept, just tried it and it works, but it doesn't really suit my scenario.

I also tried an update of the parent with new child records (which would work for me) but it doesn't seem to work, I got the following message: "Deep update of navigation properties is not allowed"

Have you ever tried to do this? update a parent record with new child records? Am I doing something wrong or it's just not possible?

As far as I know it's not possible to do this via an update. The original implementation was just for create, and I don't believe it has changed since then

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Users online (3,655)