Copying sysiD from old instance to new

SathiskumarD
Tera Contributor

 

Hello,

 

I was trying to do transform map of work type records from old instance(A) to the new instance (B). We need sysIDs to be copied to the new instance. Below is the onBefore transform script. However, this isn't working. Anything wrong with my code? Any help or direction to resolve this would be greatly appreciated. 

 

 

 

 

 

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

	if (action == "insert") {target.setNewGuidValue(source.sys_id); }

})(source, map, log, target);

 

 

 

1 ACCEPTED SOLUTION

Hello @SathiskumarD , I'll suggest to create coalesce on the sys_id so that no conflict with the sys_id as you are trying to import something that is supposed to be unique across the platform.

Could you please delete the respective entries from the ServiceNow and try again by keeping the script enabled.

View solution in original post

11 REPLIES 11

Hello @SathiskumarD, what's the error message? and did you check the column name in staging table where you mapped the sys_id from the xls file?

 

Regards,

Nishant

I didn't map the sysID. 

Hello @SathiskumarD, This error doesn't seem to be related to the script. Could you please verify your mapping once again especially which field has been used as a coalesce? If the problem still persists, start with the basic steps meaning just keep minimum rows in the file and then keep on adding. 

 

Regards,

Nishant

I tried only with 5 rows (or records). Name field is sued as coalesce. Howevr, it still keep creating new sysID instead of copying old sysID from other insatnce!

Hello @SathiskumarD , I'll suggest to create coalesce on the sys_id so that no conflict with the sys_id as you are trying to import something that is supposed to be unique across the platform.

Could you please delete the respective entries from the ServiceNow and try again by keeping the script enabled.