In our earlier article we discussed how we can create data in Dynamics 365 CE using Microsoft Flow from excel file. Now in this article we are going to discuss how we can update existing data using flow.
Requirement: In our earlier example we used following excel table to upload data to contact entity,
Now let’s say we have updated some data and added some new records, now we want to update existing data based on the email id of contact and if it’s not available we want to create it (like upsert operation)
Follow our earlier article and implement step 1-4 to achieve following:
Now lets add a List Records action from Dynamics 365 and configure it like following, here we are going to query Dynamics 365 contacts based on the email id from excel file.
Now lets add a condition to check if list of records not empty, first add condition and set value like following
After that click on Edit in advance mode and change it like below, here we are checking if the above list record action returned null value.
Now after check above condition we need to add Create step under Yes section and Update section under No section like following
and need to configure update like following
We can set other fields using expression items(‘Apply_to_each’)[‘ColumnNameFromExcelFile’] . Finally add delete step to delete the excel file from one drive.
Now save your changes and upload file to one drive after couple of mints we will be able to see contact data like following
If contact exists with email id it will update contact otherwise it will create new contact record.
Stay tuned for more Dynamics 365 Contents !!