Concatenate 2 fields and set it as coalesce in transform map

Manikandan2
Kilo Expert

Hi, In my table i have 2 fields, CI and company. 1 Company can have multiple CI's and 1 CI can have multiple companies. So when i do a data import it needs to concatenate Company&CI like below example and check if that combination exist. If that exist then it should update else it should insert.

In the below table, i cannot set CI as Coalesce neither i can company as Coalesce but the combination of them is always unique. How do i set a coalesce on the combination field

Example: 

CICompanyCombination
ABC-01-AvailXYZ-comp-1ABC-01-AvailXYZ-comp-1
ABC-02-AvailXYZ-Comp-1ABC-02-AvailXYZ-comp-1
ABC-01-AvailXYZ-Comp-2ABC-01-AvailXYZ-comp-2
ABC-02-AvailXYZ-Comp-2ABC-02-AvailXYZ-comp-2
1 ACCEPTED SOLUTION

Xavier Cordero
Kilo Sage

Hello Manikandan,

Concatenating the fields should not be necessary. When you select multiple coalesce fields within ServiceNow, all of the fields must match for the coalesce, in other words, for the record you're trying to add, both the company and CI would need to match (look at https://docs.servicenow.com/bundle/london-platform-administration/page/administer/import-sets/concep...).

View solution in original post

4 REPLIES 4

Xavier Cordero
Kilo Sage

Hello Manikandan,

Concatenating the fields should not be necessary. When you select multiple coalesce fields within ServiceNow, all of the fields must match for the coalesce, in other words, for the record you're trying to add, both the company and CI would need to match (look at https://docs.servicenow.com/bundle/london-platform-administration/page/administer/import-sets/concep...).

Thank you

Vishal Khandve
Kilo Sage

Hi,

use below script to concatenate.

 

 

answer = (function transformEntry(source) {

// Add your code here

var field1 = source.u_ci;

var field2 = source.u_company;

var comm = field1+" "+field2;


return comm; // return the value to be put into the target field

})(source);

 

also keep coalesce true.

 

Thanks,

vishal

Thank you for the code Vishal. This also works