The Zurich release has arrived! Interested in new features and functionalities? Click here for more

sys id not matching

menoss
Kilo Contributor

Hi all,

Im in the process of trying to import company details. However the source sys_id seems to match the target sys_id but when i check in the "companies" section, it seems to make up another sys_id.

I have the following script:

var name = source.u_name.toString();

log.info("MP: name = " + name.toLowerCase());

if(name.toLowerCase() == "evides"){

  ignore = false;

  log.info("MP: Imported " + name);

  log.info("MP: before source.u_sys_id = " + source.u_sys_id + " target.sys_id = " + target.sys_id);

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

  log.info("MP: after source.u_sys_id = " + source.u_sys_id + " target.sys_id = " + target.sys_id);

}

else{

  ignore = true;

  log.info("MP: Ignored " + name);

}

Where am i going wrong?

Thanks in advance for your help!

Menosshan

1 ACCEPTED SOLUTION

Hi Menosshan,



Is it possible the sys_id's exist elsewhere on the system?   I'd have thought it best not to set a sys_id of a record unless you're importing XML records between instances



Simon


View solution in original post

6 REPLIES 6

sergiu_panaite
ServiceNow Employee
ServiceNow Employee

How does the output of these log lines show?



log.info("MP: before source.u_sys_id = " + source.u_sys_id + " target.sys_id = " + target.sys_id);


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


  log.info("MP: after source.u_sys_id = " + source.u_sys_id + " target.sys_id = " + target.sys_id);



Regards,


Sergiu


When i run the script and check the logs i get the following output:




MP: before source.u_sys_id = 24043f494fa7c200a5f5b4a18110c765 target.sys_id =



MP: after source.u_sys_id = 24043f494fa7c200a5f5b4a18110c765 target.sys_id = 24043f494fa7c200a5f5b4a18110c765



However when i search the company and check its sys_ID, it shows me the following id:



feba061f4fb856000f901b818110c78e



Thanks



Menosshan


Hi Menosshan,



Is it possible the sys_id's exist elsewhere on the system?   I'd have thought it best not to set a sys_id of a record unless you're importing XML records between instances



Simon


menoss
Kilo Contributor

Hi Simon,



Thanks for your suggestions, i managed to find the issue. The problem was that the source table has two sys_id's and i just choose the wrong one. There was one "sys_id" and another called "Sys_id". I picked the wrong source but now it seems to match the id's.



Thanks a lot for your input and all the others who replied with suggestions!



Menosshan