Let’s learn about how to fetch data from Cosmos DB using Power Automate and push into Dynamics CRM.
For retrieving the data from Azure Cosmos DB we will need a few details from Azure:
1. URI 2. Primary Key
Let’s jump to Power Automate and start adding the necessary component for achieving this activity.
I have used a manual trigger for reading the data from Azure Cosmos DB and pushing it into Dynamics CRM. Chose an action –> Search for Azure Cosmos DB, then under action select Get all documents.
We will use the Azure Cosmos DB detail for establishing the connection as shown in the below image. Access Key to your Azure Cosmos DB account here we have to enter Primary Key as shown under Figure 1. Hit Create button.
Select the desired database under the Database ID and table under the Collection ID field and hit the + New step button.
After the connection has been successfully established. Search for Parse JSON and add Documentsunder the Contentfield. Paste the JSON output under the schema. Hit the + New step button.
Next, we will search for a control Apply to each.
Under, Select an output from previous steps field pastes the Bodyfrom the Dynamic content and click Add an action button.
The above action is needed as it will allow us to map the value coming from JSON to be stored inside Dynamics CRM entity attributes.
Now, we need to test our flow with a few more clicks to be performed. Click on the Test button which would appear on the right top of the screen.
The flow will start executing, once the flow has run successfully we will get the below screen.
Now, go into CRM and we will see the records have been created under the expected entity.
Logic Apps is a cloud service which is managed by Microsoft Azure. It helps us in automating the business processes.
Why use Logic Apps?
Logic apps is very simple and has a very powerful workflow which is managed by Microsoft Azure. It helps in building a server less architecture, so the user does not have to worry about hosting, scaling or managing the solution. Azure Logic Apps contains 200+ connectors with it and provide users the facility to go ahead and implement another new connector if needed.
Logic apps has a very powerful architecture for logging and tracking the run history, trigger history and performance. All these activities can be access from a governance dashboard in Azure.
Another important advantage of Logic Apps is that “you pay only for what you use”. Pricing
is done based on the number of actions happening within the Logic Apps, if the
Logic Apps is sitting ideal there won’t be any charges incurred.
Components of Logic Apps
How Logic Apps works?
Logic Apps works as a workflow which trigger when a specific event occurs or when any criteria is met.
Logic App can be scheduled as well so that it triggers on a time interval. User need to use a Schedule trigger.
Whenever the Logic App is triggered, the set of action
associated to it also gets executed. Actions can include multiple conditions
like switch statement, Looping, If and else condition or branching.
Example: Whenever a trigger detects an event which matched
the trigger criteria, it fires and run the workflow actions.