The CreatorCon Call for Content is officially open! Get started here.

How to get an array object into an for-each flow designer

James T
Tera Contributor

I've developed an Action that obtains chat data from MS teams, I've managed to parse the message content into an Object Array, and parse this out as an output variable to flow designer. I want to write each message to the notes in the trigger incident however I cannot seem to get the flow to instantiate the inputs. The Array Object structure is:

{
    "Message Object": {
        "messages": [
            {
                "createDate": "2020-08-25T00:54:53.399Z",
                "displayName": "ServiceNow IntegrationHub",
                "message": "<attachment id=\"71ff67b1dd3d4095a5ff349ba66909a1\"></attachment>"
            },
            {
                "createDate": "2020-08-31T01:43:01.447Z",
                "displayName": "orgid:577176a8-3413-42fe-9ebf-82c12b43f182",
                "message": "Major Incident Tech Bridge - INC00379920"
            },
            {
                "createDate": "2020-08-31T01:44:12.488Z",
                "displayName": "orgid:577176a8-3413-42fe-9ebf-82c12b43f182",
                "message": "Major Incident Tech Bridge - INC00379920"
            },
            {
                "createDate": "2020-08-31T02:15:42.441Z",
                "displayName": "orgid:577176a8-3413-42fe-9ebf-82c12b43f182",
                "message": "Major Incident Tech Bridge - INC00379920"
            },
            {
                "createDate": "2020-08-31T03:20:04.699Z",
                "displayName": "orgid:577176a8-3413-42fe-9ebf-82c12b43f182",
                "message": "Major Incident Tech Bridge - INC00379920"
            },
            {
                "createDate": "2020-08-31T10:33:49.752Z",
                "displayName": "ServiceNow IntegrationHub",
                "message": "<div><div>This is a test at 20:33 on Monday night</div>\n\n\n</div>"
            },
            {
                "createDate": "2020-08-31T11:03:12.281Z",
                "displayName": "ServiceNow IntegrationHub",
                "message": "Update at 21:03"
            },
            {
                "createDate": "2020-08-31T01:12:06.341Z",
                "displayName": "orgid:577176a8-3413-42fe-9ebf-82c12b43f182",
                "message": "Test Meeting 3"
            },
            {
                "createDate": "2020-08-31T01:26:12.248Z",
                "displayName": "orgid:577176a8-3413-42fe-9ebf-82c12b43f182",
                "message": "Major Incident Tech Bridge - INC00379920"
            },
            {
                "createDate": "2020-08-31T01:29:43.825Z",
                "displayName": "orgid:577176a8-3413-42fe-9ebf-82c12b43f182",
                "message": "Major Incident Tech Bridge - INC00379920"
            },
            {
                "createDate": "2020-08-31T01:30:42.059Z",
                "displayName": "orgid:577176a8-3413-42fe-9ebf-82c12b43f182",
                "message": "Major Incident Tech Bridge - INC00379920"
            },
            {
                "createDate": "2020-08-31T01:32:02.132Z",
                "displayName": "orgid:577176a8-3413-42fe-9ebf-82c12b43f182",
                "message": "Major Incident Tech Bridge - INC00379920"
            },
            {
                "createDate": "2020-08-31T01:35:59.806Z",
                "displayName": "orgid:577176a8-3413-42fe-9ebf-82c12b43f182",
                "message": "Major Incident Tech Bridge - INC00379920"
            },
            {
                "createDate": "2020-08-31T01:37:20.487Z",
                "displayName": "orgid:577176a8-3413-42fe-9ebf-82c12b43f182",
                "message": "Major Incident Tech Bridge - INC00379920"
            },
            {
                "createDate": "2020-08-31T01:38:10.08Z",
                "displayName": "orgid:577176a8-3413-42fe-9ebf-82c12b43f182",
                "message": "Major Incident Tech Bridge - INC00379920"
            },
            {
                "createDate": "2020-08-31T01:41:10.442Z",
                "displayName": "orgid:577176a8-3413-42fe-9ebf-82c12b43f182",
                "message": "Major Incident Tech Bridge - INC00379920"
            }
        ]
    }
}

 

I feel i'm missing something obvious, though the night is getting late and i'm struggling to see the simplest mistakes. Any help appreciated. 

 

find_real_file.png

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you will have to iterate using For each action

you possibly need to convert that into array

Flow Designer

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you will have to iterate using For each action

you possibly need to convert that into array

Flow Designer

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thanks for the advice, found the issue. Needed to define a stingArray output not an object array.

Nice to hear.

The same was mentioned in my previous comment and the link shared.

Please mark my response as correct and helpful to close the thread

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

2 years might be too long to expect a response but I appear to have the same issue. I've changed the outputs on my flow action to array.string but I now get a list of:

     "[object Object]",
        "[object Object]",
        "[object Object]",

Is there something else I need to do? I used this doc to create the action in the first place.