flow designer - custom actions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 12:50 AM
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..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 01:07 AM
Hi @Rahul84 ,
If the structure of the response body is always the same then you can use something like this:
responseBody.result[0].sys_id
Please mark the answer "Correct" or "Helpful", if it helps your case.
Cheers,
Uttkarsh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 01:28 AM
Hi @Rahul84
Try below script approach :
var parsedJson = JSON.parse(jsonString); //Assuming jsonString variable hold your API JSON Response
return parsedJson.result[0].sys_id;
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 02:03 AM
Thanks @Amit Verma for the reply..
so where do you suggest me to use the script step to get the sys_id from the response body of 1 custom flow action which I want to use as an input to other action..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 02:32 AM
You can make use of Script Step in your custom action itself. After you are done with the API call step, take the output JSON in one of the step output variable and pass it to the Script Step as an input. Inside the Script step, make use of the script I provided.
If you could share some screenshots, I will be able to visualize and assist in a better way.
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.