我使用两个表“new_demotable001”和“new_metadatatable”。一个用于触发流程,另一个作为映射表。
通过使用两者,我想创建一个 JSON 有效负载,用于调用外部 API。 请帮我创建有效负载。
{
"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"
}
}
详情:
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')),
'},{', ','),
'[', ''),
']', '')
)}
}
备注:
selectAttributes
步骤是映射属性及其值的关键步骤。payload
步骤将上一步中的数组转换为具有字符串操作的 JSON 对象。详情:
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')),
'},{', ','),
'[', ''),
']', '')
)}
}
备注:
selectAttributes
步骤是映射属性及其值的关键步骤。payload
步骤将上一步中的数组转换为具有字符串操作的 JSON 对象。