Source script

rishi4200
Giga Expert

Hi Experts,

I am trying to copy the OOB incident number value from instance 1 to a custom field called u_incident_number on instance 2.

I have written below source script but when checked found that it is returning undefined value as you can see in below screenshot.

Can anyone please tell me what is wrong with this script.

Please consider below screenshot for your reference.

ImportSet.PNG

ImportSet1.PNG

Thank you.

Rishi

1 ACCEPTED SOLUTION

Hi Rishi,



In the source script you are not supposed to use the target object. modify your code as below and test again.



var x = source.number; // ensure number is the correct column from import set table since the import set table is a custom table and fields should start with "u_"


gs.log('Number is: ' + x);


return x;



Also since you are not modifying any value from the incoming number field before mapping why to use source script and not directly have 1 to 1 mapping?


Any specific reason to have source script here



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

9 REPLIES 9

Hi Ankur,



I will try above and get back to you.


Also I have already tried using 1 to 1 mapping but it is not working.


Please refer below thread for more details:


Servicenow to Servicenow interation



Thank you.


Hi Rishi,



Any update on this?


Can you mark my answer as correct, helpful and hit like if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.



Regards


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Rishi,



Did you get this resolved?



Regards


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,



My issue has been resolved now.


Thank you for your help !!




Regards,


RIshi


Hi Rishi,



That's great. Could you also mark my answer as correct. Thanks in advance.



Regards


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader