The CreatorCon Call for Content is officially open! Get started here.

Need to write Transform Script for checking source and target field values mapping

Rushil1
Kilo Contributor

Need to write Transform Script for checking source and target field values mapping. Need to validate values of source field against values of target field. need to write transform script for this

Issue Faced: Values not matching.

Requirement: Help me to write the script logic to match the fields.

3 REPLIES 3

Saiganeshraja
Kilo Sage
var s = new GlideRecord("Target Table Name");

s.addQuery("number",source.number); /// Primary Key that will identify the record can be sys_id as well

s.addQuery("targetfieldname",source.ImportSetFieldName);

s.query();

if(s.next())

{

return true; // Indicate the source field value and target field value are matched.

}

return false; // Indicate the source field value and target field value are not matched.



Mark correct and helpful

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

What's your business requirement here?

what script did you start with and where are you stuck?

Regards
Ankur

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

need to create a transform script so that System should validate the values of a target field as provided in servicenow record. In case values of source field provided by load file doesn’t match with the records in ServiceNow then it should throw an error.