Escaping special characters in XML
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2021 11:36 PM
Hello, i need to escape special characters from string to safely insert them into XML document (for example "&" to "&" etc). Is there any build in function to do that?
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2021 12:12 AM
Hi,
So did you check this method which I mentioned
setStringParameter()
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
06-01-2021 12:15 AM
I think that this method is meant to be use in outbound rest message. I don't know how to implement it in rest step in flow designer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2021 12:25 AM
Hi,
are you picking some field value which contains HTML string?
Can you share some more details for that REST Step you are using with some screenshot
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
06-01-2021 01:04 AM
in flow designer i created action which does two things: 1st it fetch incident record in script step and assigning it fields values to script outputs and 2nd in rest step in request body there is xml template and i just take fetched data and put it in correct xml tags. To be honest there is a lot of sensitive data in this rest step so screen shot is not a good idea. I tried to call script include
var xmlUtils = new XMLUtilJS();
gs.info(xmlUtils.escapeForXMLText("test&test"));
but I somehow can't get to escapeForXMLText method
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2021 12:11 AM