- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2018 08:06 AM
Hi Community,
I have developed an outbound integration in ServiceNow. For failed transactions, i have created a retry policy and a business rule to create an incident. However while parsing xml, it is giving null value.
I want to parse the below parameter:
\
In my BR, i am using:
var payld = current.input_queue.payload;
var snowgrp = gs.getXMLText(payld,"//http_status_code");
gs.log("Value of snowgrp is"+snowgrp);
Logs:
Any help on this would be appreciated.
Solved! Go to Solution.
- Labels:
-
Integrations

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2018 01:41 PM
Well you could either use
var xmlDoc = new XMLDocument(current.input_queue.payload,true);
inc.work_notes = "The incident failed to send notification to end user. Error code is " + xmlDoc.getAttribute("//parameter[@name=\"http_status_code\"]","value");
or
var xmlDoc = new XMLDocument(current.input_queue.payload,true);
var errorCode = xmlDoc.getAttribute("//parameter[@name=\"http_status_code\"]","value");
inc.work_notes = "The incident failed to send notification to end user. Error code is " + errorCode;
Just depends if you want to create a variable for it or just use the parsing directly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2018 01:11 PM
I am not able to follow you. I changed my code to below and now nothing is happening. Even the incident is also not created. Please advise.
var xmlDoc = new XMLDocument(current.input_queue.payload,true);
gs.print(xmlDoc.getAttribute("//parameter[@name=\"http_status_code\"]","value"));

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2018 01:20 PM
Strange it worked when I tried it in a fixscript. Perhaps if you try to use payld that you have instead of current.input_queue.payload directly.
Also do you have an example of the whole XML (current.input_queue.payload)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2018 01:33 PM
Thanks Simon, it worked finally. What would be the name of the variable if i want to show the value on inc worknotes?
What would be the value of var below:
inc.work_notes = "The incident failed to send notification to end user. Error code is "+var;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2018 01:41 PM
Well you could either use
var xmlDoc = new XMLDocument(current.input_queue.payload,true);
inc.work_notes = "The incident failed to send notification to end user. Error code is " + xmlDoc.getAttribute("//parameter[@name=\"http_status_code\"]","value");
or
var xmlDoc = new XMLDocument(current.input_queue.payload,true);
var errorCode = xmlDoc.getAttribute("//parameter[@name=\"http_status_code\"]","value");
inc.work_notes = "The incident failed to send notification to end user. Error code is " + errorCode;
Just depends if you want to create a variable for it or just use the parsing directly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2018 02:21 PM