- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2020 03:28 AM
Hi All,
I need to fetch a value from the response body which i have received it from the SOAP step:
Fig:
Can some help me how do i fetch any value from the xml response which i am getting in the responsebody input variable?
Thanks,
Ak
Solved! Go to Solution.
- Labels:
-
flow designer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2020 11:34 AM
So the problem is the body which is returned from integration.
See formatted XML
Below works but it's not good for long time solution.
var response = inputs.response_body.toString();
var xmldoc = new XMLDocument(response);
if(xmldoc.toString().indexOf('name=') > -1){
var nm1 = (xmldoc.toString().split('name="')[1]);
var nm2 = (nm1.toString().split('"')[0]);
outputs.groupname = nm2;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2020 05:52 AM
Hi,
please check below links & they should help you
https://www.youtube.com/watch?v=18DnY4FfMqI
https://developer.servicenow.com/blog.do?p=/post/ny_flow_designer_2/
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2020 07:39 AM
Hi
in script step: i trying to fetch an element from the xml generated in SOAP step. but i am unable to mapp it with the output:
(function execute(inputs, outputs) {
// ... code ...
var responseBody=inputs.response_body;
var xmlDoc = new XMLDocument2();
xmlDoc.parseXML(responseBody);
gs.info(xmlDoc.getNodeText("//name"));
//var xmldoc = new XMLDocument2(responseBody, true);
//var str = xmldoc.getNodeText("//association/name"); // returns the first occurence of the node
outputs.groupname = xmlDoc.getNodeText("//name");
})(inputs, outputs);
Thanks & Regards,
Ak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2020 08:18 AM
Hi,
are you able to parse it properly but unable to map it?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2020 09:00 AM
yes