- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2018 10:42 PM
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.
Thank you.
Rishi
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2018 11:22 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2018 10:51 PM
Could you please add logs in source script to see if source.number is getting valued properly.Also check with the import set table if corresponding import set record has number field valued and field name is correctly mapped in the source script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2018 10:52 PM
Hi Rishi
1. In the script you are not returning the value of the number
2. Script should not contain the target.u_.............
3. It should return only the value from source table
Script should be "answer = source.u_number " ; // the source is the import set table. Check the number field name there. I think it will be u_number.
But, you do not need to write a script for this. you can map the fields directly from source to target.
-harsh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2018 11:12 PM
Hi Harsh,
Thank you for your response !
I have followed above steps but it is not working. Can you please go through below thread if possible in order to understand what I am trying to achieve here and share your inputs.
Servicenow to Servicenow interation
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2018 11:22 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader