how to get the sys_id's to import in a transform map?

Michael Culhan1
Kilo Sage

I have records in a table in a scoped application that I would like to copy to dev on a regular basis for testing.  Currently, I do this manually using export XML/ import XML, which works great and keeps the sys_id's the same on both instances.  Because this is done regularly, I would like to schedule it.  I have tried to use a Data Source --> Transform Map.  In the transform map I map the sys_id from the import set table to the SysID in the target table as per this documentation page.  However, when i run the transform, the records in the target table are assigned new sys_id's.  Is there something else I need to do?

find_real_file.png

This question mentions section 3.4 of a wiki article but this may be for prior versions.

3 REPLIES 3

Anil Lande
Kilo Patron

Hi,

Do you have sys_id's in the Excel sheet which you are uploading ?

You have selected the sys_id column  of import set table and not the one which contains sys_id's provided by you.

If you have sys_id column in your excel sheet then the column must be created with name u_sysid or u_sys_id.

 

Thanks,

Anil Lande

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Thanks Anil.  I double checked, the sys_id selected in the transform map is u_sys_id which is the sys_id from the table in the production instance. 

samfindlay94
Tera Contributor

Probably a bit late now but I had this same question and now have the answer. You can use ".setNewGuidValue" to achieve this. So what I did was to use an on before transform script which contains below code

 

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
	if (action == "insert"){
		target.setNewGuidValue(source.u_sys_id);
	}
})(source, map, log, target);

 

https://developer.servicenow.com/dev.do#!/reference/api/utah/server/no-namespace/c_GlideRecordScoped...