cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Help in fetching array field using format_map in workato

amaan
Deputy Chef II
Deputy Chef II

Scenario is like - 
Input array : [name, error: [code: "test", detail : "missing test"]]
So im currently querying like Input array.format_map('Name : %{name}, Error Detail : %{"what should be the query here to get detail field from error list in input array"}').

1 ACCEPTED SOLUTION

amaan
Deputy Chef II
Deputy Chef II

workato sol2.png

 

I got the solution for the problem , we just need to extract both the field in array format then use format_map %s notation to fetch the value from nested array.
workato sol.png

 You can check out the documentation as well herehttps://docs.workato.com/en/formulas/array-list-formulas.html#format-map 

View solution in original post

6 REPLIES 6

gary1
Star Chef I
Star Chef I

Your input array looks incorrectly formatted. Can you provide an actual example, something that is correctly formatted?

amaan
Deputy Chef II
Deputy Chef II

Below is the exact data for reference @gary1

"results": [
     {
       "external_id": "xyz",
       "index": 0,
       "errors": [
         {
           "code": "CustomObjectRecordCreateOrUpdateByExternalIdFailed",
           "title": "Record validation errors",
           "detail": "Name cannot be blank"
         }
       ],
       "status": "Failed"
     }
]

So i need to use format_map on result array and pluck detail field from errors list.
 

shivakumara
Executive Chef III
Executive Chef III

Hi @amaan ,
Here is one of the solution, 

Format map formulae.png

Please let me know if you have any question.

Thanks and Regards,
Shivakumara K A

Hi @shivakumara , thanks for the input but this approach does not solve the requirement i want each object to aligned with proper external id along with its error detail , the solution you posted will give first object detail of errors list only and that too at the end, not along the external ids.

 

workato ques.png