Transform Script to update Location field in Transform Map

Saib1
Tera Guru

Hi ,

I need to update the Target field based on the input from Source in Transform Map . 

Below is the Source Fields and Traget field

Need to hard code through script for the following 

For Example : if (San Newyork) update in target as Newyork

 Please help on this writing transform script.

 

 

find_real_file.png

11 REPLIES 11

Sulabh Garg
Mega Sage
Mega Sage

Hello

you can write source script as follows

if (source.<source field> == "San Newyork")

{

target.<target field> = "Newyork";

}

Hope it helps

Please Mark Correct/helpful, if applicable, Thanks!! 

Regards

Sulabh Garg

Please Mark Correct/helpful, if applicable, Thanks!!
Regards
Sulabh Garg

Hi ,

 

Need something like elsif ? I attached above with three rows

Then do it like this

 

if (source.<source field> == "San Newyork")

{

target.<target field> = "Newyork";

}

else if (source.<source field> == "Oracle Melbourne")

{

target.<target field> = "Melbourne";

}

else if (source.<source field> == "WebLogic eCOM America" || source.<source field> == "VmMORREF.....")

{

target.<target field> = "America";

}

 

Hope it helps..!!

Please Mark Correct/helpful, if applicable, Thanks!!
Regards
Sulabh Garg

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Since target field is reference you need to set sys_id OR you can use setDisplayValue() if you know the exact name of location

something like this; adding to what Sulabh shared

if (source.u_source_data_center == "San Newyork")
{
	target.setDisplayValue("locationField","Newyork");
}
else if (source.u_source_data_center == "Oracle Melbourne")
{
	target.setDisplayValue("locationField","Melbourne");
}
else if (source.u_source_data_center == "WebLogic eCOM America" || source.u_source_data_center == "VmMORREF.....")
{
	target.setDisplayValue("locationField","America");
}

Regards
Ankur

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