Logic App to push data from Cosmosdb into CRM and perform an update

Stack Overflow Asked on January 5, 2022

I have created a logic app with the goal of pulling data from a container within cosmosdb (with a query), looping over the results and then pushing this data into CRM (or Common Data Service). When the data is pushed to CRM, an ID will be generated. I wish to then update cosmosdb with this new ID. Here is what I have so far:

enter image description here

This next step is querying for the data within our cosmosdb database and selecting all IDS with a length that is greater than 15. (This tells us that the ID is not yet within the CRM database)

enter image description here

Then we loop over the results and push this into CRM (Dynamics365 or the Common Data Service)

enter image description here

Dilemma: The first part of this process appears to be correct, however, I want to make sure that I am on the right track with this. Furthermore, once the data is successfully pushed to CRM, CRM automatically generates an ID for each record. How would I then update cosmosDB with the newly generated IDs?

enter image description here

Any suggestion is appreciated

One Answer

I see a red flag in your approach here with this query with length( > 15. This is not something I would do. I don't know how big your database is going to be but generally not very performant to do high volumes of cross partition queries, especially if the database is going to keep growing.

Cosmos DB already provides an awesome streaming capability so rather than doing this in a batch I would use Change Feed and use that to accomplish whatever your doing here in your Logic App. This will likely give you better control of the process and likely allow you to get the id back out of your CRM app to insert back into Cosmos DB.

Because you will be writing back to Cosmos DB, you will need a flag to ignore the update in Change Feed when the item is updated.

Answered by Mark Brown on January 5, 2022

Add your own answers!

Related Questions

Update a with react

1  Asked on December 30, 2021 by mara-oliveira


Euclidean distance of all pandas rows to single row

1  Asked on December 30, 2021 by aquamad96


Different result with online compiler and visual code

0  Asked on December 30, 2021 by swayamjeet-swain


recursive function debug asserion failed

2  Asked on December 30, 2021 by steven-zhou


SQL Grant Execute On Object where do I put GO?

2  Asked on December 30, 2021 by andy-williams


Split string by comma unless followed by a space or a ‘+’

3  Asked on December 30, 2021 by callum-brown


Get values of cells in dataframe column quickly

2  Asked on December 30, 2021 by user11035198


Parsing XML values in Javascript

2  Asked on December 30, 2021 by topcat3


split sequences

1  Asked on December 30, 2021 by backgroup


when checkbox checked value true, display text not displayed

4  Asked on December 30, 2021 by user11247496


.net core 2.0 logging inside Kubernetes pod console

1  Asked on December 30, 2021 by abhay


XML vs JSON vs SQLite for only reading data

9  Asked on December 30, 2021 by brandon-cornelio


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP