flow designer - custom actions

Rahul84
Tera Contributor

hello Developers,

 

I am getting this below response from one of the API call which I am doing through the flow action.

Below is the response body..

{"result":[{"sys_id":"a1861bdcd7011200f2d224837e610328","sys_updated_by":"admin","sys_created_on":"2023-10-05 16:58:55","sys_mod_count":"1","sys_updated_on":"2023-10-05 16:58:55","sys_tags":"","user":"506c0f9cd7011200f2d224837e61030f","sys_created_by":"admin","group":"0a52d3dcd7011200f2d224837e6103f2"}]}

 

Ask is I want to fecth the sys_id from the response body and pass this as an input to other custom flow action.

 

Please  help me how I can fetch the sys_id from the above response so that I can pass this an input to other flow action..

6 REPLIES 6

I am having 2 custom actions

1). Get member from group - having rest step and GET method to fetch the records.

2). Remove member from group - having delete method..

my first action ( get member) is able to fetch the record through an api and below is the response body for it. I am storing this response in one of the output variable I have created in the same action( get member). I want to fetch the sys_id out of it and need to pass this sys_id as an input to other action ( remove member from action ) to make a another api call which have delete method.

I am calling these both actions from a common flow.

 

{
"result": [
{
"sys_id": "a1861bdcd7011200f2d224837e610328",
"sys_updated_by": "admin",
"sys_created_on": "2023-10-05 16:58:55",
"sys_mod_count": "1",
"sys_updated_on": "2023-10-05 16:58:55",
"sys_tags": "",
"user": "506c0f9cd7011200f2d224837e61030f",
"sys_created_by": "admin",
"group": "0a52d3dcd7011200f2d224837e6103f2"
}
]
}

 

Rahul84_0-1711448476860.png

 

Rahul84_1-1711448637062.png

 

 

@Rahul84 

 

Please have a look on the below example :

 

AmitVerma_0-1711451964476.png

 

You can make use of this script action just after your REST Step in Get Member from Group action. Map the input variable jsonString with the output variable of your REST STEP then make use of the script which I shared earlier to parse the JSON and get the sysID. We will store this sys_id in the Script Step action.

 

AmitVerma_2-1711452646633.png

 

Finally, set the output variable sysid as shown below :

AmitVerma_1-1711452601132.png

 

When you will test it, you will get the sys_id in your output variable which you can pass to your other action in the flow.

 

 

AmitVerma_4-1711452821866.png

AmitVerma_5-1711452844274.png

 

Thanks and Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.