- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2019 11:13 PM
Hi,
I am sending fields value to another SNOW instance using SOAP message. I have used Business rule to insert and update the values of fields. I am sending values of few fields in work notes. It is not working for the values containing either & or white space. I tried to replace these as mentioned below but it is not working. Can anyone help me with this?
current.work_notes.toString().replace(/[&]/g, '&');
current.work_notes.toString().replace(/[ ]/g, ' ');
Thanks in advance!
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2019 12:44 AM
Hi Naina,
I believe you are saying about these 5 special characters which needs to be escaped before sending in xml or else xml string will break
" "
' '
< <
> >
& &
var data = current.work_notes.toString();
if(data.indexOf("'") > 0){
data = data.replaceAll("'","'");
}
else if(data.indexOf("\"") > 0){
data = data.replaceAll("\"",""");
}
else if(data.indexOf("<") > 0){
data = data.replaceAll("<","<");
}
else if(data.indexOf(">") > 0){
data = data.replaceAll(">",">");
}
else if(data.indexOf("&") > 0){
data = data.replaceAll("&","&");
}
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
‎01-17-2019 12:44 AM
Hi Naina,
I believe you are saying about these 5 special characters which needs to be escaped before sending in xml or else xml string will break
" "
' '
< <
> >
& &
var data = current.work_notes.toString();
if(data.indexOf("'") > 0){
data = data.replaceAll("'","'");
}
else if(data.indexOf("\"") > 0){
data = data.replaceAll("\"",""");
}
else if(data.indexOf("<") > 0){
data = data.replaceAll("<","<");
}
else if(data.indexOf(">") > 0){
data = data.replaceAll(">",">");
}
else if(data.indexOf("&") > 0){
data = data.replaceAll("&","&");
}
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