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.

How to concatenate 2 source fields into 1 target field on a transform map

Charles Hong
Mega Expert

Hello - i have a transform map importing in data from an excel sheet and i want to take 2 fields from the spreadsheet and concatenate them into one field onto the importing table.I have tried multiple scripts but can't seem to work. Could someone please give me some input on my script below? 

 

find_real_file.png

1 ACCEPTED SOLUTION

you can add another space between two string.

 

here we go. 

 

var op = abc+' '+abc1;

View solution in original post

7 REPLIES 7

you can add another space between two string.

 

here we go. 

 

var op = abc+' '+abc1;

thanks. 

answer = (function transformEntry(source) {

// Add your code here

var abc =source.fieldA;

var abc1 = source.fieldB

var op = abc+' '+abc1;
return abc; // return the value to be put into the target field

})(source);

 

This option did not work for me as returning abc only returns the source.fieldA so I changed it to the following, and it worked:

var op = abc+' '+abc1;
return op; // return the value to be put into the target field