- 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 01:10 AM
Hi Muktha,
Can you share the updated field map script and also how the incoming value looks like; add some logs to check what the incoming value is; on safer side you can convert the incoming value to lower case and then compare
the conversion to lower case will handle below values TRUE, True, TRue, TrUE, true, TRue etc
answer = (function transformEntry(source) {
var incomgingValue = source.u_present;
gs.info('Incoming value is: ' + incomgingValue);
incomgingValue = incomgingValue.toLowerCase();
if(incomgingValue == 'true')
return true; // return the value to be put into the target field
else
return false;
})(source);
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
03-01-2021 01:36 AM
Hope you are doing good.
Did my reply answer your question?
If so, please mark appropriate response as correct & helpful so that the question will appear as resolved for others who may have a similar question in the future.
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
04-05-2020 09:57 AM
Hi Muktha,
Any update on this?
Can you mark answer as ✅ correct, 👍 helpful if you were able to achieve the requirement. This enables other members to learn from this thread.
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
03-26-2020 12:53 AM
Hello Muktha,
You just Convert that "true" "false" string first(upper/lower) then assing to that field using function you can convert
current.short_description.toUpperCase(); or
current.short_description.toLowerCase();
do this in field map only I sure it will work.
if my response helps you then kindly mark my answer helpful and correct otherwise if any query feel free to ask further.
Regards,
Ajim.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2020 12:58 AM
and make sure when assigning true/false value don't use double or single quotes as I saw you written
source.u_present = "true"; wrong
source.u_present = true; right