Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Transform map script to insert drop down field values.

Tarasingh26
Tera Expert

Hi All,

 

I have requirement in which I need to import data into table using transform map. Impact type, category and sub category are drop-down values. Category and subcatergory are dependent upon impact type. I have to skip wrong combination of above fields. I have written code attached in screenshot. But it is not working. Can someone please let me know where could be issue?

 

Thanks,

Tara Singh 

1 REPLY 1

Community Alums
Not applicable

You can write script as below may be you have to modify below script as per your requirement .

-----------------------------------------------------------------------------------------------------------------

// Get values from the source

var impactType = source.u_impact_type;

var category = source.u_category;

var subcategory = source.u_subcategory;

-------------------------------------------------------------------------------------------

// Check if the combination is valid

if (isValidCombination(impactType, category, subcategory))

{

// Map the fields to the target

target.impact_type = impactType;

target.category = category;

target.subcategory = subcategory;

} else

{

// Skip the record if the combination is invalid

target.skip = true;

}