Use PDIs? Take our 5-minute survey to help shape the PDI roadmap.

How to create a custom Reject Major Incident Candidate modal in Service Operations Workspace?

sirishanavu
Giga Contributor

Hi Community,

I’m working on a customization in Service Operations Workspace for the Incident table.

I need to replace/customize the Reject Major Incident Candidate action with a custom modal/popup. I do not want to modify the OOTB implementation directly; I want to create a separate custom implementation following the ServiceNow recommended UX Framework approach.

Requirement

When an Incident Analyst clicks Reject Major Incident Candidate, I want to open a custom modal containing:

  1. Reject Reason – mandatory textarea

  2. A simple text:
    “Do you want to modify Impact & Urgency?”

  3. Impact – dropdown

  4. Urgency – dropdown

  5. Cancel button

  6. Reject button

Expected behavior

When the user clicks Cancel, the modal should close and no Incident changes should be made.

When the user clicks Reject:

  • Update the Incident Impact with the value selected in the modal.

  • Update the Incident Urgency with the value selected in the modal.

  • Set the Major Incident state to Rejected.

  • Preserve/update the relevant Proposed by / Proposed fields using the existing Major Incident rejection logic.

  • Add the entered Reject Reason to the Incident Work notes.

  • Save/update the Incident.

Server-side logic

I have already created a custom Script Include using AbstractAjaxProcessor:

var RejectMajorIncidentAjax = Class.create();
RejectMajorIncidentAjax.prototype = Object.extendsObject(AbstractAjaxProcessor, {

    rejectMajorIncident: function() {

        var sysId = this.getParameter("sysparm_sys_id");
        var workNotes = this.getParameter("sysparm_work_notes");
        var impact = this.getParameter("sysparm_impact");
        var urgency = this.getParameter("sysparm_urgency");

        var gr = new GlideRecord("incident");

        if (!gr.get(sysId))
            return "ERROR";

        gr.impact = impact;
        gr.urgency = urgency;

        var mim = new sn_major_inc_mgmt.MajorIncidentTriggerRules(gr);
        mim.rejectMIC(workNotes);

        return "SUCCESS";
    },

    type: "RejectMajorIncidentAjax"
});

What I am looking for

I would like guidance on the recommended ServiceNow Workspace/UX Framework implementation for this requirement.

Specifically:

  • How should I create the custom modal?

  • Should I use a custom Macroponent + sys_modal?

  • How should the custom Declarative Action open the modal?

  • What is the recommended way to pass the current Incident sys_id to the modal?

  • How should the Impact, Urgency, and Reject Reason values be passed from the modal to a UX Client Script/GlideAjax call?

  • How should the modal be closed after successful rejection?

I found the OOTB Problem → Assess Declarative Action, which uses:

declarative_action_type = uxf_client_action

However, I have not been able to trace the referenced client_action to determine exactly how the OOTB modal is being launched in my instance.

I would prefer a custom implementation without modifying the OOTB Reject Major Incident Candidate action or other OOTB components.

Any guidance on the correct architecture and step-by-step configuration would be greatly appreciated.

Thanks!

5 REPLIES 5

@sirishanavu ,
Could you paste your client script here to debug?
One more thing here you are trying to set just values the selected in the Modal right.If it is only setting the values selected in the modal means no need of script include here.

you can set directly by following,

 g_form.setValue('your_field_name', fieldValues.updatedFields[0].value);

here index 0 at upadtedFields[0] represents the first field in the modal.

If my response helped mark it as helpful and accept the solution.
Thanks,
Dinesh.