Recently while working on the integration of Facebook Lead Ads with CRM, through Webhooks / Power Automate we had to process the lead data and create lead and contact records.
Below is a sample format in which we’d get the lead data for the FB form having a first name, last name, date of birth, and email fields in it.

Now we want to create an object having name as proprety and value from values like below from the above response, which will make it easy for use to refer in add a new row / update a row Dataverse step.
For this we will be using addProperty function.

Below is our sample flow –

First we are initializing varJSON – string variable with the JSON response

Than intializing the another variable varFieldData as type Object

Parse JSON action using the sample response.

Here we are interested in field_data property

So in the next step, we loop through each field_data, than use addProperty function in Compose to add name and value to the varFieldData object, and use the outputs of compose to set the varFieldData variable.

addProperty function – addProperty(variables(‘myObject’), ‘newProperty’, ‘propertyValue’)
In the next step, we can see the varFieldData and the way we can access the property last_name added to it.

On running the flow we can see the result as expected –

Hope it helps..
Like this:
Like Loading...