I’m using two tables ‘new_demotable001’ and ‘new_metadatatable’. One to trigger the flow and another as Mapping Sheet, respectively.
By using both I want to create a JSON payload that I’ll use to call external API. Please help me create the payload.
<Details/Prerquisite>
- When a new row added in new_demotable001, flow triggers.
- The data/attributes we will receive from table are –
Note: I’ve removed unnecessary attributes.
{
"new_empname": "GivenEmpName",
"new_demotable001id": "259ffaeb-a354-ef11-bfe3-000d3af2cd77",
"new_empcontact": "9889489038",
"new_name": "DemoDataTestin",
"new_empstatus": 100000001,
"_new_empstatus_label": "On-Boarded"
}
- Then fetch details from ‘new_metadatatable’ table using “List Rows”.
- The data/attributes we will receive from table are –
Note: I’ve removed unnecessary attributes.
{
"@Microsoft.Dynamics.CRM.totalrecordcount": -1,
"@Microsoft.Dynamics.CRM.totalrecordcountlimitexceeded": false,
"@Microsoft.Dynamics.CRM.globalmetadataversion": "10896094",
"value": [
{
"new_sirionattributename": "title",
"new_dynamicsattributename": "new_empname"
"new_name": "First"
},
{
"new_sirionattributename": "test1",
"new_dynamicsattributename": "new_empcontact",
"new_name": "Second"
},
{
"new_sirionattributename": "orgId",
"new_dynamicsattributename": "new_empstatus",
"new_name": "Third"
}
]
}
- Now, I want to create a JSON payload using above attributes. To create payload we will use only those attributes which are present in ‘new_metadatatable’ and also coming from ‘new_demotable001’.
-> The Condition I used – contains(triggerOutputs()?[‘body’], items(‘Apply_to_each’)?[‘new_dynamicsattributename’]) - For above set of data, the expected output payload should be-
{
"data":{
"title": "EmpName5",
"test1": "555555555555",
"orgId": "100000001"
}
}