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

Basha4
Tera Expert

In Field Map, in the source table, I have two fields and I want to add two fields and the result comes in the target table 

ex: First name & Last Name, both added and results may come in the target table

1 ACCEPTED SOLUTION

Allen Andreas
Administrator
Administrator

Hello,

You can either use a field map on one source field (but then check the script box) or use the transform map script (script field right in the center of the transform map itself) and do something like:

//for field map
var string = source.u_first_name.toString() + " " + source.u_last_name.toString();
return string;

//for transform map
var string = source.u_first_name.toString() + " " + source.u_last_name.toString();
target.field_name = string;

The above are examples, please take it from here!

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

5 REPLIES 5

Palanivel J
Tera Contributor

Day - 28 ServiceNow Interview Questions - 28

 

⭐⭐⭐⭐⭐ - Question

 

--------------------- Import set -----------------------------------

 

1) In Field Map, in the source table, I have two fields and I want to add two fields and the result comes in the target table

 

eg: First name & Last Name, both added and results may come in the target table.

 

 

Ans)

You can achieve either use a šŸš¢šžš„š š¦ššš© on one source field (but then check the script box) or use the š­š«ššš§š¬šŸšØš«š¦ š¦ššš© script (script field right in the center of the transform map itself) 

 

 

 

//for field map

var string = source.u_first_name.toString() + " " + source.u_last_name.toString();

return string;

 

(or)

 

//for transform map

var string = source.u_first_name.toString() + " " + source.u_last_name.toString();

target.field_name = string;

 

 

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

" Information is wealth" ✨