- 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-25-2020 11:57 PM
if(source.u_present == "TRUE" || source.u_present == 'True' || source.u_present == 'true')
{
target.field_name_at_target_table= "true";
}
You need to set value in target table and it's field not source table if it's true.
Mark my ANSWER as CORRECT and HELPFUL if it helps.
- 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 12:38 AM
I tried it out Ankur,it is not working. The excel data may have "True or TRUE values also. But only when we change the source data excel sheet values to true it gets set in the target table.
Even if we check the source data for capital TRUE and make it true in the ON before script , it is not getting set. Now I tried with the field map script as you told. Then also it is not getting set. What could be the issue?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2020 12:48 AM
Hi,
As per @Ankur Bawiskar said create a field map script on target field.And use some log in it. So that it is easy to get where the script fail.
answer = (function transformEntry(source) {
if(source.u_present == "TRUE" || source.u_present == 'True' || source.u_present == 'true')
{
gs.log("In If condition");
return true; // return the value to be put into the target field
}
else
{
gs.log("In else");
return false;
}
})(source);
Thanks,
Kunal