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>
{
"new_empname": "EmpName5",
"new_demotable001id": "259ffaeb-a354-ef11-bfe3-000d3af2cd77",
"new_empcontact": "555555555555",
"new_name": "DemoDataTestin",
"new_empstatus": 100000001,
"_new_empstatus_label": "On-Boarded"
}
{
"@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"
}
]
}
{
"data":{
"title": "EmpName5",
"test1": "555555555555",
"orgId": "100000001"
}
}
Details:
Step: rowDemo
Action: Compose
Comment: you don't need this step, just for demo, this is the first JSON.
Step: metaData
Action: Compose
Comment: you don't need this step, just for demo, this is the second JSON.
Step: selectAttributes
Action: Select
From: outputs('metaData')['value']
Map left: item()?['new_sirionattributename']
Map right: outputs('rowDemo')?[item()?['new_dynamicsattributename']]
Step: payload
Action: Compose
Inputs:
{
"data": @{json(
replace(
replace(
replace(
string(body('selectAttributes')),
'},{', ','),
'[', ''),
']', '')
)}
}
Notes:
selectAttributes
step is the key step for mapping the attributes and their values.payload
step converts the array from the previous step, into a JSON object with string manipulation.