how to set value of choice field in transform map?

Ashwini Jadhao
Giga Guru

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");

1 ACCEPTED SOLUTION

Dhananjay Pawar
Kilo Sage

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

View solution in original post

6 REPLIES 6

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Dhananjay Pawar
Kilo Sage

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