- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 04:48 PM
Hi All,
Another good one, I'm working on a REST API Bridge of sorts via flow designer and I have created a custom action with some script steps and REST step that accomplishes this. The script step is where I have an issue that I'm trying to parse out the response body and get the record number that was just created in instance b from instance a. First lets start with the response body:
{"result":{"body":{"message":"Creation Success!","detail":"CNDT-INC2201988"}}}
The part I want is in the detail section the record number CNDT-INC2201988 here is what I have scripted so far in the script step on the action but its not returning a value:
The responseObject segment is where I'm fuzzy on exactly how to write that line, I haven't been able to find much on it either. Any help anyone can provide would be much appreciated!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 06:22 PM - edited 11-20-2023 06:24 PM
Hi @Chad R
As per your response body JSON structure ({"result":{"body":{"message":"Creation Success!","detail":"CNDT-INC2201988"}}}), In your script change line number 7 to this.
outputs.ensono_id = responseObject.result.body.detail;
If this didn't work, log the response body using gs.info() and give the structure.
gs.info("Response Body: " + JSON.stringify(responseObject));
Please mark my answer helpful and accept as a solution if it helped 👍✔️
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2023 06:22 PM - edited 11-20-2023 06:24 PM
Hi @Chad R
As per your response body JSON structure ({"result":{"body":{"message":"Creation Success!","detail":"CNDT-INC2201988"}}}), In your script change line number 7 to this.
outputs.ensono_id = responseObject.result.body.detail;
If this didn't work, log the response body using gs.info() and give the structure.
gs.info("Response Body: " + JSON.stringify(responseObject));
Please mark my answer helpful and accept as a solution if it helped 👍✔️
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2024 11:05 PM
I'm on similar situation.
Creating a custom action & trying to retrieve u_partner_ticket_id from the response body.
I have tried both, But no luck.
Also on incident, Description is not fetching group name.
Not sure why it says '[object GlideRecord] '.
Please suggest
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2023 08:06 AM
Sorry I am late to responding this was super helpful and got this working thanks again!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2023 06:57 PM
I'm glad that it helped you 👍
Anvesh