- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2017 01:00 AM
Hi,
I am facing to fetch the node value of one the attributes. In my XML Payload, the response is something like:
<domain>europe.abc.com</domain>
Or
<domain>pacific.abc.com</domain>
Or
<domain>americas.abc.com</domain>
Or
<domain>abc.com</domain>
I need to read the first value (before dot) of the attribute <domain>.
So my desired output is: europe Or pacific Or americas Or abc.
I am using below line to get the value but i am getting 'undefined' always
var dom = xmldoc.getNodetext("//domain")
Please advise if anyone knows the solution of it.
Regards
Vishal
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2017 09:05 AM
Hi Vishal,
The dom variable should print the value "europe.abc.com" and you wanted to retrieve the value "europe" so as I mentioned earlier in my comment you will have to split using dot
var dom = "europe.abc.com"; // this you are getting as per your comment
var splitValues = dom.split(".");
var firstValue = splitValues[0]; // this prints europe
var secondValue = splitValues[1]; // this prints abc
var thirdValue = splitValues[2]; // this prints com
Can you try and let me know?
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
‎02-15-2017 01:50 AM
Hi Vishal,
Great that it worked. Could you also mark the answer as helpful and hit like? Thanks in advance.
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
‎04-06-2020 06:14 AM
Hi Ankur,
How to read XMl payload,
I have requirement to read data from Payload,but Payload contains data like
<?xml version="1.0" encoding="UTF-8"?><results probe_time="4755" result_code="0"><result><output>Request Status Code:200
Response:<?xml version="1.0" encoding="UTF-8"?><applist xmlns:xsi="http&#x3a;&#x2f;&#x2f;www.w3.org&#x2f;2001&#x2f;XMLSchema-instance" app app_id="375" app_name="AIP" policy_updated_date="2019-11-13T11&#x3a;38&#x3a;00-05&#x3a;00"/>
<app app_id="651" app_name="AMP"/>
<app app_id="580819" app_name="AMP-API-File-Registry-Save"/>
</applist>
</output></result>
Means Inside Xml one more Xml is presented.
Could you help me to how to read this data and store into a table.
Thanks,
Uma.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2020 10:09 AM
Hi Uma,
Not sure whether it would be a valid response xml within xml from 3rd party application
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
‎10-21-2020 02:35 PM
Hi Ankur,
Thank you for sharing the solution, I am stuck in a similar kind of issue.
Scenario:
When i retrieve an update set from dev to test i find that some of the customer updates for their respective retrieved update set are showing wrong.
I mean that the updated by field on the "sys_update_xml" table and the sys_updated_by field in the payload field (String) are different.
Is there a way to update the updated by field on the sys_update_xml table to be same as the sys_updated_by from the payload?
Use Case: using this for automating the change ticket creation with the help of flow designer. There are many update sets which are in complete state in test but for each individual update set there is a respective change ticket automatically created, So if we can either capture the sys_updated_by from the xml payload of the customer update it would solve the issue.
Please let me know if you have a solution for it.
Thanks,
pK.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2020 02:35 PM
Hi Ankur,
Thank you for sharing the solution, I am stuck in a similar kind of issue.
Scenario:
When i retrieve an update set from dev to test i find that some of the customer updates for their respective retrieved update set are showing wrong.
I mean that the updated by field on the "sys_update_xml" table and the sys_updated_by field in the payload field (String) are different.
Is there a way to update the updated by field on the sys_update_xml table to be same as the sys_updated_by from the payload?
Use Case: using this for automating the change ticket creation with the help of flow designer. There are many update sets which are in complete state in test but for each individual update set there is a respective change ticket automatically created, So if we can either capture the sys_updated_by from the xml payload of the customer update it would solve the issue.
Please let me know if you have a solution for it.
Thanks,
pK.