- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2020 12:28 PM
Trying to modify the OOB UI Action to Create Standard Change. The OOB UI Action has only 1 line and that is:
action.setRedirectURL(new StdChangeUtils().getURLForTask(current, 'rfc'));
I have looked at the script include StdChangeUtilsSNC and read that you can override the functions in there, but I don't think that's really what I need to do. That one line redirects me properly to where I would select the type of Std Change I want. However, what I would like to do is make some changes to the record that I'm currently on prior to being shipped off to the selection. For example, set the state to Pending and also write a Work Note that a Std Change was created.
The problem is, any other line that I put in this script blows it up.
So if I do this:
current.state = -5; // Pending
current.u_pending_reason = "Pending Change Request";
current.work_notes = "Standard Change created";
var mySysID = current.update();
action.setRedirectURL(new StdChangeUtils().getURLForTask(current, 'rfc'));
It goes no where. I can't even get gs.log statements to work.
Any ideas?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2020 12:39 PM
As a workaround, can you try this:
var grIncident = new GlideRecord('incident');
if (grIncident.get(current.sys_id)) {
grIncident.work_notes = "Standard Change created";
grIncident.state = -5;
grIncident.u_pending_reason = "Pending Change Request";
grIncident.update();
}
action.setRedirectURL(new StdChangeUtils().getURLForTask(current, 'rfc'));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2020 12:39 PM
As a workaround, can you try this:
var grIncident = new GlideRecord('incident');
if (grIncident.get(current.sys_id)) {
grIncident.work_notes = "Standard Change created";
grIncident.state = -5;
grIncident.u_pending_reason = "Pending Change Request";
grIncident.update();
}
action.setRedirectURL(new StdChangeUtils().getURLForTask(current, 'rfc'));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2020 01:03 PM
Works great. Thx for the quick response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2024 03:53 PM
what if I want set parent field on standard change request with the sys_id of the task it is created from. for example, if i want to create standard change from INC12345, parent field on change should have display value INC12345.?