Parsing and performing operations on embedded arrays in Flow Designer

michaelsmith02
Tera Contributor

*Reposting in HAM Forum location, posted in wrong location previously

 

I am building a 3 custom table relationship and have to parse the below JSON example to insert records into an "order" table, "sku" table, and "asset" table (not alm_asset or alm_hardware, a custom table with additional asset info). While doing so, I need to make sure the correct records are assigned to the reference fields in each table. 

 

SKU references Order. Asset references SKU and Order. Here is the example JSON:

 

{

    "SHIPMENTNUMBER": "DKSDXXXXXX",

    "SHIPMENTDATE": "YYYYMMDD",

    "YOURREFERENCE": "XXXXXXXXXXXX",

    "EXTDOCNO": "XXXXXXXXXXXX",

    "ORDERNUMBER": "DKSOXXXXXX",

    "PORTALORDERNUMBER": "WOXXXXXXXXDK",

    "CURRENCY": "USD",

    "TRACKINGNUMBER": "",

    "COURIER": "COURIERNAME",

    "TRACKINGLINK": "TRACKINGLINK",

    "PARTIALDELIVERY": "TRUE/FALSE",

    "LINES": [{

        "SKU": "XXXXXXXXX",

        "DESCRIPTION": "DESCRIPTION OF SERVICE",

        "QUANTITY": "1",

        "TYPE": "Service",

        "CATEGORY": "CATEGORY",

        "SERIALS": [{

            "SERIALNO": "XXXX"

        }],

        "STAGINGINFORMATION": [{

            "CAPTION": "XXXX",

            "SERVICE": "XXXX",

            "SET": "XXXX",

            "VALUE": "XXXX"

        }]

    }]

The specific issues I am having are:

 

  1. Getting a 500 'Internal Server Error' when running flow (attached pics). I have another flow with a JSON object with strings and an embedded object which inserts records into two tables just fine, but this specific structure is throwing this error.

 

michaelsmith02_0-1748025862107.png

 

The trigger is set up like this

michaelsmith02_1-1748025862109.png

 

michaelsmith02_2-1748025862110.png

 

I've tried to make a JSON parser action, but there are not enough inputs (it maxes out at 20) to accommodate the entire structure. I tried re-configuring the action with inputs up to the "LINES" array and retrieving the rest of the values from the output, but that didn't work either.

 

  1. Inserting records from the same flow and assigning the correct referenced record in the appropriate reference fields. As mentioned in 1, I have another flow which does create two records. First in "order" and then in "sku", however, when inserting the "sku" record and assigning the value into the "order" reference field, it does not populate. 

michaelsmith02_3-1748025862112.png

 

 

How can I properly configure this flow to insert the records correctly with these embedded arrays and how do I get the reference fields to pick up the proper referenced record?

3 REPLIES 3

Pankaj kr
Kilo Sage

Hi @michaelsmith02 ,

 

Your attached images are very blurry, can you reupload the same? It will be easier to help you out.

 

If this helped you, pls mark this helpful and accepted.

Hello, I was not aware, here are a new set of images! 

The first 3 are the flow in which I'm having trouble looping through the embedded arrays in flow designer. The last picture is the reference field I am attempting to populate but it is not inserting values

OrderShippedFlow.pngOrderShippedResponseBody.pngOrderShippedResponseBody2.pngOrderConfirmedFlow.png

Hello! I was not aware, here are a new set of images. The first 3 are of the flow in which I'm having trouble accessing and looping through the embedded arrays to insert records. The last picture is the flow in which I'm trying to populate a reference field from the first inserted record. It is not picking up any valueOrderShippedFlow.pngOrderShippedResponseBody.pngOrderShippedResponseBody2.pngOrderConfirmedFlow.png