- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2020 04:58 AM
Hi,
I am setting value of choice field in transform map with script as below but it is not working it will set value as 2-Medium always .
(function transformRow(source, target, map, log, isUpdate) {
if (source.priority== 'High') {
target.priority == gs.setValue("target.priority",1);//1 is 1 - High
}else if (source.priority== 'Medium') {
target.priority== gs.setValue("target.priority",2);// 2 is 2-Medium
}else if (source.priority== 'Low') {
target.priority== gs.setValue("target.priority",3);//3 is 3-Low
}
// Add your code here
})(source, target, map, log, action === "update");
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2020 05:17 AM
Hi,
(function transformRow(source, target, map, log, isUpdate) {
var priprityVal=source.getValue('priority');
if(priprityVal=='High')
{
target.priority ='1';
}
else if(priprityVal=='Medium')
{
target.priority ='2';
}
else
{
target.priority='3';
}
})(source, target, map, log, action==="update");
Thanks,
Dhananjay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2020 05:37 AM
Hi,
I believe the answer you marked as correct the same script was already provided by Jaspal and his comment was the 1st response to your question. Any specific reason you didn't mark Jaspal's answer as correct?
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
04-23-2020 05:17 AM
Hi,
(function transformRow(source, target, map, log, isUpdate) {
var priprityVal=source.getValue('priority');
if(priprityVal=='High')
{
target.priority ='1';
}
else if(priprityVal=='Medium')
{
target.priority ='2';
}
else
{
target.priority='3';
}
})(source, target, map, log, action==="update");
Thanks,
Dhananjay