- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2024 05:27 AM
Hi Team,
we are loading a data to a a field name is OWNER it is a choice field in the ServiceNow target table, having choices of Vanco and Customer.
from data source excel we have a field like Owner it is having a integer value like 0 and 1 .
we are mapping Owner fields from excel (data source) to the OWNER field in ServiceNow.
written one onBefore transform script like below, considering '0' as a Vanco and '1 'considering as a Customer.
But this script is not working as expected, values are inserting as integer only like below, not as a Vanco or Customer.
please guide me to correct this, or how to trouble shoot this?
Regards,
Abhilasha G T
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2024 05:56 AM
Hi @Abhilasha G T,
What you are trying to do is correct, try the same script in the field mapping script.(Within the field mapping , there is a field called "use source script" enable it as true and add the above script)
Else if you want to go with on before script means , rephrase your script as below:
if (source.u_owner=="0"){
target.u_choice_u_owner="Vanco";
else{
target.u_choice_u_owner="Customer";
}
Its better to utilize field mapping script for this kind of scenario
Try this solution, if this works for you, mark mine as accepted
Regards
Vengadesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2024 05:56 AM
Hi @Abhilasha G T,
What you are trying to do is correct, try the same script in the field mapping script.(Within the field mapping , there is a field called "use source script" enable it as true and add the above script)
Else if you want to go with on before script means , rephrase your script as below:
if (source.u_owner=="0"){
target.u_choice_u_owner="Vanco";
else{
target.u_choice_u_owner="Customer";
}
Its better to utilize field mapping script for this kind of scenario
Try this solution, if this works for you, mark mine as accepted
Regards
Vengadesh