How to map string choice field to integer choice field using transform source script ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2020 05:40 AM
Hi All ,
I am having a string choice field on import set table (table a)and i want to map the field to the target table's (table b) integer choice field.For Eg if in the import set table the status is disposed then on the target table the value will be mapped as retired. If anyone knows please help me out.
Thanks,
Dinesh Kumar G

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2020 05:55 AM
Hi,
I just wanted to check in on this. If my reply helped guide you correctly, please mark it as Helpful & Correct.
Thank you!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2020 03:43 PM
Hi,
I just wanted to check-in on this.
If my reply above helped guide you correctly, please mark it as Helpful & Correct.
Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2020 05:49 AM
In addition to Allen's suggestion, you may also consider a switch statement to more cleanly handle each case without writing separate if/else statements.
var val;
switch (source.status) {
case 'Deployed > Active':
case 'Deployed':
case 'Deployed > Inactive':
case 'Deployed > To Be Disposed':
val = 2;
break;
case 'Disposed':
val = 1;
break;
}
return val;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2020 03:30 PM
Yea, thanks. There's a multitude of ways to do it. Thanks for offering that up though.
The thing here is that if they don't know JavaScript and you're trying to do something more "fancy" then you could confuse someone, but still good to mention either way. We could all respond for days about "how" to do it, haha.
Thanks for helping
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2020 06:17 AM
Hi Dinesh,
As suggested you will have to use field map script for this field in your transform map; sample script below:
you will required to add else if statement for every choice value; ensure you set choice action as ignore for the choice list field
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