I'm working a Retrieve Audit Details Response message from the Dynamics WEB API. I can get the correct data from Dynamics, but I can't figure out how to process it in a Flow.
Here's a sample of the entire response:
{
"body": {
"@odata.context": "https://xxx.crm.dynamics.com/api/data/v9.2/$metadata#Microsoft.Dynamics.CRM.RetrieveAuditDetailsResponse",
"AuditDetail": {
"@odata.type": "#Microsoft.Dynamics.CRM.AttributeAuditDetail",
"InvalidNewValueAttributes": [],
"LocLabelLanguageCode": 0,
"DeletedAttributes": {
"Count": 0,
"Keys": [],
"Values": []
},
"OldValue": {
"@odata.type": "#Microsoft.Dynamics.CRM.account",
"websiteurl": "http://w.com",
"fax": "555-1234567"
},
"NewValue": {
"@odata.type": "#Microsoft.Dynamics.CRM.account",
"websiteurl": "http://www.com",
"fax": "555-555-1234",
"new_companytype": 500000000
}
}
}
}
I want to send an email with a table that looks like this --
| Old | |
| #Microsoft.Dynamics.CRM.account | #Microsoft.Dynamics.CRM.account |
| | |
| | |
| | |
The challenge is that the properties inside OldValue and NewValue are dynamic -- any number of the dozens of available columns might be included, so I can't hardcode a lookup by the property name (such as ['NewValue']['fax']). And it is also possible that the column will not be included in OldValue, if the value was previously null. I'd like to do it this way, because we have a lot of columns and some will be very wide, and I want to avoid horizontal scrolling in my email.
I can use a Create HTML Table note, but that gives me a result that is a wide table, like the above, but the rows and columns are transposed, which is not ideal.
I've been playing with string parsing and JSON object manipulation, and I'm leading myself in circles. Does anyone have any advice or pointers?
EDIT: Thinking a little outside the box, I tried using the results of Create HTML Table and applying a CSS transform in the email styles. No luck.