- 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:17 AM
Hi,
you can use workflow run script and sample script like this
var rec = new GlideRecord('incident');
rec.initialize();
rec.short_description = current.variables.variableName;
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:23 AM
Hi,
Thanks for the reply,
I have tried the above script in UI Action without workflow and it doesnot work.
I need the script for UI Action where the some variables in RITM must be mapped in Incident
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2022 02:33 AM
Hi,
logic still remains the same
If your UI action is on RITM table then you can access variable value like this
current.variables.<variableName>
Ensure you map to correct field
For Example: Reference variable to user table can be mapped with caller_id of incident
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:42 AM