JSON Array Flow Designer

kemmy1
Tera Guru

With the help of this lovely community, I am now able to gather an array (and store it) using JSON Parser and the object.array output:

var wsArray = [];
var item = JSON.parse(inputs.ResponseBody);
var totalWS = Object.keys(item.membership.workspaces).length;
for (var i = 0; i < totalWS; i++){
var wsObject = {};
wsObject.title2 = item.membership.workspaces[i].title;
wsArray[i] = wsObject;
}
outputs.wsname = wsArray;

I set up my output variables:

find_real_file.png

 

Here is my output from that script action:

{
    "wsname": {
        "wsn": [
            {
                "title2": "abc API Trial - Your first workspace"
            },
            {
                "title2": "abc API Trial 2" } ] } }

But then on my output action, the output is:
find_real_file.png
[ { "title2" : "ICE API Trial - Your first workspace" }, { "title2" : "ICE API Trial 2" } ]

I'd like to create a flow that takes this data and for each title, create a record in servicenow. How do I do this?

Lisa
2 REPLIES 2

Anirban Roy
Mega Guru

Hi,

Call this action from a parent flow, where you can use the titles from the object.

Below links might be helpful -

https://docs.servicenow.com/bundle/orlando-servicenow-platform/page/administer/flow-designer/concept...

https://docs.servicenow.com/bundle/orlando-servicenow-platform/page/administer/flow-designer/task/cr...

 

Regards,

Anirban

Allen Andreas
Tera Patron

This is from 2 years ago. Not sure why it's randomly showing back up (in recent list -- and somehow shows an update of like 30 minutes ago), but putting this message here so others don't go through a bunch of effort to assist for something this old, unless it's still needed by the author.

Please mark reply as Helpful, if applicable. Thanks!