Creating Related Change without leaving the form

General Add comments

Leaving isn’t necessarily good – except when you’re at the dentist maybe….
I’m sure most of you are familiar with the context action “Create Change” in the incident form.

This action will open a new form with a newly created change request and information from the originating incident populate the newly created change request.

Now there might be situations where you would like to stay on the incident form but still be able to create a new related change request.
For these situations you can create a new UI action and use the following sample information.

Create a new UI action “Create Related Change”.


Create Related Change 





Action Name: 




Show Update:     


Form Button: 








[cc lang=”javascript”]
function create_related_change() {
// Create a dialog form, set the submit action to call the function ‘setRFCField’
var dialog = new GlideDialogForm(‘Create Change’, ‘change_request’,setRFCField);
// Set the sys_id to -1 to create a new record
// Specify a form view
dialog.addParm(‘sysparm_view’, ‘default’);
// Leave the related lists on the form visible
dialog.addParm(‘sysparm_form_only’, ‘false’);

dialog.setLoadCallback(function(iframeDoc) {
// To get the iframe: document.defaultView in non-IE, document.parentWindow in IE
var dialogFrame = ‘defaultView’ in iframeDoc ? iframeDoc.defaultView : iframeDoc.parentWindow;

// Take the Configuration Item from the incident and fill that in the change request
dialogFrame = null;

// Open the dialog

// This function fills the rfc field in the incident form with the sys_id
function setRFCField(action, sys_id, table, displayValue){
// Set the user field with the popup change request
g_form.setValue(“rfc”, sys_id);

The button ‘Create Related Change’ will now be visible in the ‘incident’ form.

When we click the ‘Create Related Change’ button a change request form will appear in front of the ‘incident’ form.

If you have selected an incident with a ‘Configuration Item’ filled in then you will see the same ‘Configuration Item’ filled in on the ‘change request’ form.
You will see also that the ‘Related Lists’ like ‘Notes’, ‘Schedule’ & ‘Planning’ are visible.

Fill in the rest of the (required) fields for the ‘change request’ and click on the ‘Submit’ button.

The incident form ‘Change Request’ field will now be populated with the newly created ‘Change Request Number’.

If you have any questions you can contact me by mail at .img[at].img.

One Response to “Creating Related Change without leaving the form”

  1. Travis Says:

    Great article! Thanks.

Leave a Reply