The CreatorCon Call for Content is officially open! Get started here.

From where the pop up appears on workspace and how to add the field in the pop up.

Advaitk
Tera Contributor

 

Hi everyone,
In the Security Incident workspace, when we change the State of a security incident record to Closed, a pop-up appears prompting us to fill in mandatory fields. In that pop-up, there is a section that includes the Close Code field.
I would like to add a custom field below the Close Code field in this pop-up.
Could someone please explain:

  • How this pop-up is triggered (what controls its appearance)?
  • How can I customize or edit the fields shown in this pop-up to add my custom field?

Screenshot 2025.png



Thanks in advance for your help!

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@Advaitk 

did you check any onChange client script on State field is showing that modal?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hello @Ankur Bawiskar 

Thanks for the quick response.
Yes I found two  onChange client script based on "State" field. 

1. Show Hide the closure and pir tabs

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue == '') {
      return;
   }
   if(oldValue == newValue){
        if(newValue != 100) hideClosureInfo();
        return;
   }
   //if request is closed or in review then show closure information
   if (g_form.getValue('state') == 3){
        g_form.setSectionDisplay("closure_information", true);
        g_form.setSectionDisplay("post_incidentreview", true);
        if (g_form.hasField("pia") && g_scratchpad.isPiaSkillActive) {
            g_form.setSectionDisplay("post_incidentanalysis", true);
            g_form.setDisplay("pia", true);
        }
    }
    else{
        hideClosureInfo();
    }
    function hideClosureInfo(){
        g_form.setMandatory("close_code", false);
        g_form.setMandatory("close_notes", false);
        g_form.setSectionDisplay("closure_information", false);
        g_form.setSectionDisplay("post_incidentreview", false);
        g_form.setSectionDisplay("post_incidentanalysis", false);
        g_form.setDisplay("pia", false);
    }
}

2. Resolution details visibility on state (This is present in workspace view and workspace application. I think this is most related to our question)
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   
    var mandatory = false;
    if (g_form.hasField('state')) {
        var incident_state = g_form.getValue('state');
        mandatory = incident_state == 100 || incident_state == 3 || incident_state == 4;
    }
    g_form.setSectionDisplay('resolution', mandatory);



Martin Virag
Mega Sage
Mega Sage

Hi! 

This is a part of the Record UIB page, you can configure the modal there

Screenshot 2025-10-03 at 13.29.08.png

Hi @Martin Virag ,
Thanks for the response!

I followed your instructions, but I'm not sure how to add the existing field there.

 

Screenshot 2025-10-03 172846.png