- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2022 02:11 AM
HI All,
Could you suggest javascript code to how to Map variables present in RITM to fields in INCIDENT table.
Thanks
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2022 10:58 PM
Hi,
script should work fine provided
1) the variable on RITM is correct and refers to cmn_department
2) you should insert() and not update
var rec = new GlideRecord('incident');
rec.initialize();
rec.department= current.variables.department;
rec.insert() ;
Regards
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
08-19-2022 02:52 AM
Hello ,
you need to insert the record but you are using update method which will not insert the record so try below
replace update with insert and it should work
var rec = new GlideRecord('incident');
rec.initialize();
rec.department= current.variables.your_variable_name;
rec.insert() ;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2022 03:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2022 03:07 AM
Which type of filed is u_department on the RITM form ?and which type on incident form ?
1)make sure back end names from both the tables are correct
also replace with this line
rec.department= current.variables.u_department.toString();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2022 03:17 AM
In RITM ,Department is Reference Variable taken from cmn_department table.
In incident it is Field with same table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2022 03:42 AM
also is the record getting inserted?
then is should map can you post your full UI action script please ?