I am trying to build a child flow to update SharePoint lists using HTTP. To do so I need to pass a JSON like the following to the child flow. :
{
"__metadata": @{json(concat('{"type":"SP.Data.', replace(replace(outputs('SettingsCDRAccounts')['listName'], ' ', '_x0020_'),'-',''), 'ListItem"}'))},
"ID": @{xpath(xml(outputs('XMLSPArray-CDR-Accounts')),concat('string(//Array[Title/text()="', item()['Id'],'"]/ID/text())'))},
"Title": @{item()?['Id']},
"LastModifiedDate": @{item()?['LastModifiedDate']},
"AccountName": @{item()?['Name']},
"AccountTheater": @{item()?['Theater__c']},
"AccountRegion": @{item()?['Operation_Region__c']},
"AccountArea": @{item()?['Area__c']},
"AccountNumber": @{item()?['Account_Number__c']},
"": ""
}
The issue is that you can't build a JSON like this in the parent because Power Automate tries to complete the "@{item()?['...']}" functions when created and the data for item to evaluate is in the child flow. I need to delay the dynamic completion to the correct spot in the child flow.
Thank you for your help.
Hi, you might need to review your logic not sure how you can "resolve it / eval" functions in runtime in PAF, if you copy and paste that code to a compose actions indeed it will try to refer them as expressions, so you will need to pass them as strings.
{
"__metadata": "@@{json(concat('{\"type\":\"SP.Data.', replace(replace(outputs('SettingsCDRAccounts')['listName'], ' ', '_x0020_'),'-',''), 'ListItem\"}'))}",
"ID": "@@{xpath(xml(outputs('XMLSPArray-CDR-Accounts')),concat('string(//Array[Title/text()=\"', item()['Id'],'\"]/ID/text())'))}",
"Title": "@@{item()?['Id']}",
"LastModifiedDate": "@@{item()?['LastModifiedDate']}",
"AccountName": "@@{item()?['Name']}",
"AccountTheater": "@@{item()?['Theater__c']}",
"AccountRegion": "@@{item()?['Operation_Region__c']}",
"AccountArea": "@@{item()?['Area__c']}",
"AccountNumber": "@@{item()?['Account_Number__c']}"
}
and scape the fx expression with @@
regards