- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2020 11:55 PM
Hi Friends,
I have an urgent import to be made. The source data if it contains field with value "TRUE" in capital letters it does not get imported in the target table in the mapped field. I have been facing this issue. Even after checking the values using the below "On before script and then importing it does not get set. Can anyone please suggest what needs to be done?
if(source.u_present == "TRUE" || source.u_present == 'True' || source.u_present == 'true')
{
source.u_present = "true";
}
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2020 12:19 AM
Hi Muktha,
you can use field map script for this; and use below script
answer = (function transformEntry(source) {
if(source.u_present == "TRUE" || source.u_present == 'True' || source.u_present == 'true')
return true; // return the value to be put into the target field
else
return false;
})(source);
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
03-26-2020 02:32 AM
Hi Mukta,
true and false are the values having type boolean.If you use it in single quote or double quote it will be consider as string type.so,please check that in condition you used if it works.
Please mark if that help you!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2020 03:25 AM
You can code something like this.
var str = source.field_name;
var result = str.search(/true/i);
if(result != -1)
{
return true;
}
else {
return false;
}
Mark my ANSWER as CORRECT and also HELPFUL if it works.