- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-11-2021 05:10 AM
How to create a change record from a UI action on incident form and pass some details to the change record such as, short description from the incident form or any other field.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-11-2021 05:49 AM
Here is the sample code which maps incident details to change and creates a change record.
var change = new GlideRecord("change_request");
change.initialize();
change.short_description = current.short_description; // incident Short description mapped to change short description.
change.description = current.description;
change.cmdb_ci = current.cmdb_ci;
change.priority = current.priority;
var changesysID = change.insert();
action.setRedirectURL(change);
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-11-2021 05:28 AM
Yes you can re-use existing UI Actions which already have this functionality defined.
If you want the same UI Actions to be visible as form button instead of context menu then modify accordingly.
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-11-2021 05:44 AM
And How can I pass data from incident to that change record

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-11-2021 05:47 AM
Here is the sample script, here current refers to the current record , if you write this in a incident table, then current will hold incident record
var change = new GlideRecord("change_request");
change.short_description = current.short_description;
change.description = current.description;
change.cmdb_ci = current.cmdb_ci;
change.priority = current.priority;
var sysID = change.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-11-2021 05:49 AM
Here is the sample code which maps incident details to change and creates a change record.
var change = new GlideRecord("change_request");
change.initialize();
change.short_description = current.short_description; // incident Short description mapped to change short description.
change.description = current.description;
change.cmdb_ci = current.cmdb_ci;
change.priority = current.priority;
var changesysID = change.insert();
action.setRedirectURL(change);
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2022 02:32 AM
What if i wanted to open a normal change record?