Hi guys,
I have a requirement to update multiple records in F&O and send a response for each record using a logic app.
Please find the request and response in the below screenshot.
To archive my process I have followed the below steps.
1. I have utilized the 'When a HTTP request is received' trigger.
If the update fails, I am parsing the error and sending it to the 'message' variable.
- While parsing the error I have used the below JSON.
{
"status": 400,
"message": "An error has occurred. Write failed for table row of type 'CustCustomerV3Entity'. Infolog: Warning: ",
"error": {
"message": "An error has occurred. Write failed for table row of type 'CustCustomerV3Entity'. Infolog: Warning:"
"source": "URL"
}
To fetch the above error use the below expression or parse JSON.
outputs('Update_record')?['error']?['code']
Status code:
outputs('Update_record')?['statusCode']
- Afterward, I use 'Append to array variable' to create the response JSON and store it in the array.
json(string(variables('OutputJson')))
The output you will find in 1st screenshot.
Keep Daxing!!
No comments:
Post a Comment