โ09-11-2024 04:27 AM
i have created a custom action in the SF connector to read a salesforce report
the report data is contained in an array called datacells inside an array called rows
i have put the response body view and the raw json below
what is the easiest way for me to parse this into a list so i can import to an invoices in an external system?
i tried creating a for...each loop on rows but workato errors out if i try to refer to data cells[x].label
i can for each on rows and then for each on data cells but then i can't tell where i am without a variable to track where i am which seems kludgy
the response body looks like this in workato
the raw json looks like this
{
"body": {
"attributes": {
"describeUrl": "/services/data/v42.0/analytics/reports/xxxx/describe",
"instancesUrl": "/services/data/v42.0/analytics/reports/xxxx/instances",
"reportId": "xxxx",
"reportName": "Invoices Import",
"type": "Report"
},
"allData": true,
"factMap": {
"T_T": {
"rows": [
{
"dataCells": [
{
"label": "Billing Company Inc.",
"value": "xxxx"
},
{
"label": "Customer Name Ltd.",
"value": "xxxx"
},
{
"label": "-",
"value": null
},
{
"label": "Customer Name Ltd.",
"value": "xxxx"
},
{
"escapedLabel": "Customer Number",
"label": "Customer Number",
"value": "Customer Number"
},
...
"dataCells": [
{
"label": "Billing Company 2 Inc.",
"value": "xxxx"
},
{
"label": "Customer Name 2 Ltd.",
"value": "xxxx"
},
{
"label": "-",
"value": null
},
{
"label": "Customer Name 2 Ltd.",
"value": "xxxx"
},
{
"escapedLabel": "Customer Number 2",
"label": "Customer Number 2",
"value": "Customer Number 2"
},
...