Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

How to Add to Header List

tiguin2798
Tera Guru

I have recently created a new change model and I am trying to add it to the header list from incident forms. I am not seeing an option on the header list itself to configure this. How would I go about adding 'Create New High Change' to this list of options?

 

tiguin2798_0-1721073634690.png

 

2 REPLIES 2

Tony Chatfield1
Kilo Patron

Hi, if I understand your post correctly then you will need to create a new UI Action.
UI actions (servicenow.com)


For reference, these are the OOB Change Ui actions in PDI

/sys_ui_action_list.do?sysparm_query=nameLIKEchange%5Etable%3Dincident&sysparm_view=

I have started creating my UI action, but when trying to create a high priority change from an incident I get a page that states 'undefined'. I am new to Java Script and am attempting to compare the UI actions for Normal and Emergency change creations. Can you confirm if there is something here I am missing that needs to change?

 

Emergency:

 

(function(current, previous, gs, action) {
    var target = {};
    target.table = current.getTableName();
    target.sysid = current.getUniqueValue();
    target.field = 'rfc';
    try {
        target.isWorkspace = (typeof RP == 'undefined');
    }
    catch (err) {
        target.isWorkspace = false;
    }

    gs.getSession().putProperty('change_link', target);

    var changeRequest = ChangeRequest.newEmergency();
    changeRequest.setValue("short_description", current.short_description);
    changeRequest.setValue("description", current.description);
    changeRequest.setValue("cmdb_ci", current.cmdb_ci);
    if (changeRequest.hasValidChoice('priority', current.priority))
        changeRequest.setValue("priority", current.priority);
    changeRequest.setValue("sys_domain", current.sys_domain);
    changeRequest.setValue("company", current.company);
    changeRequest.insert();

    action.setReturnURL(current);
    action.setRedirectURL(changeRequest.getGlideRecord());

})(current, previous, gs, action);
 
My High Priority Script:
 
(function(current, previous, gs, action) {
    var target = {};
    target.table = current.getTableName();
    target.sysid = current.getUniqueValue();
    target.field = 'rfc';
    try {
        target.isWorkspace = (typeof RP == 'undefined');
    }
    catch (err) {
        target.isWorkspace = false;
    }

    gs.getSession().putProperty('change_link', target);

    var changeRequest = ChangeRequest.newHigh();
    changeRequest.setValue("short_description", current.short_description);
    changeRequest.setValue("description", current.description);
    changeRequest.setValue("cmdb_ci", current.cmdb_ci);
    if (changeRequest.hasValidChoice('priority', current.priority))
        changeRequest.setValue("priority", current.priority);
    changeRequest.setValue("sys_domain", current.sys_domain);
    changeRequest.setValue("company", current.company);
    changeRequest.insert();

    action.setReturnURL(current);
    action.setRedirectURL(changeRequest.getGlideRecord());

})(current, previous, gs, action);