Apostrophe in field map script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 02:47 AM
Hi team, I have a issue where I have a string value with apostrophe that needs to be set as a close code while running the transform map, I am unable to map the value as it is showing error, is there any way I can do it, please let me know.
Tried Scenarios:
1. if (source.u_code == "Issue/ Finding won't be solved") {
return "accepted";
}
2. if (source.u_code == 'Issue/ Finding won\'t be solved') {
return "accepted";
}
these above things doesn't seem to work. Below is the code for reference
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 03:10 AM
Hi,
You can change the string like below-
source={};
source.u_code = "Issue/ Finding won't be solved";//string surrounded with double quotes but within sentence single quote can be used.
if (source.u_code == "Issue/ Finding won't be solved") {
gs.info("ok")
}
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 03:14 AM
Hello @Bindhu1
You can just put your message in double quotes (" ") instead of single quotes
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates