In Dynamics 365, we can create multiple records through the OOB Import method, by using SSIS Package. In this blog, I will show how to create multiple records from XML using power automate.
Microsoft introduces many new functions, which we can use in Power Automate. Please find the below reference link of the functions.
We need to use “xml” and “xpath” functions to read and parse XML in Power Automate.
Eg. xpath(xml(Output(‘XML’)), ‘/rootnode/items’)
Below are the steps to read and parse XML and create the Account records using Power Automate:
- We need to prepare standard structure of XML before creating power automate because we need to parse XML based on the format we have.
- I have created API function to get XML in Power Automate(below is the sample XML value), so accordingly I will write an expression to parse XML in power automate.
<accountname>Royal Acc Ltd.</accountname>
<street1>321, S. V. Road</street1>
Step1: Create a Flow. Ihave created “Recurrence” flow which will trigger at 1 am every day.
Step2: Add new steps to get XML value form API.
Step3: Add compose variable to set output (response body) of Http Request.
Step 4: Use Xpath expression to read XML value
Here: Set_Http_Response is the previous step name.
Step5: Use ‘Apply for each’ control loop to read multiple records and create the same in CRM.
In these steps, we need to map the column which we want to populate data in Account from XML node values, using xpath() in expression
Below are some Example:
Account Name = xpath(item(),’string(account/accountname)’)
Address 1 : City = xpath(item(),’string(account/city)’)
Step 6: Save and Run Power Automate. We will get the below response body in HTTP request.
We can create multiple records in Power Automate using XML Data.