Tanushree Maiti
Tera Patron

Hi @RyoyaFukuda 

 

Try with this UI Action :

 

  • Action name: resolve_incident (must be unique)
  • Client: true
  • Onclick: resolveINCClient()
  • Workspace Form Button: true (Checked)
  • Format for Configurable Workspace: true (Checked)

Sample code/Not tested

function resolveINCClient () {

    var closeNotes = g_form.getValue('close_notes');   

    if (closeNotes == '' || closeNotes == null) {

        g_form.showFieldMsg('close_notes', 'Please enter a Resolution Note before resolving.', 'error');

        return false;

    }

        try {

        g_modal.confirm('Confirm Resolution', 'Are you sure you want to resolve this Incident?', function(confirmed) {

            if (confirmed) {

               gsftSubmit(null, g_form.getFormElement(), 'resolve_incident');

            }

        });

    } catch (e) {

             if (confirm('Are you sure you want to resolve this Incident?')) {

            gsftSubmit(null, g_form.getFormElement(), 'resolve_incident');

        }

    }

}

if (typeof window == 'undefined') {

    serverResolve();

}

 

function serverResolve() {

    current.incident_state = 6;

    current.state = 6;

    current.update();

    action.setRedirectURL(current);

}

 

 

Refer: How to use UI Actions in Workspaces

KB1811593 Workspace Fundamentals: Understanding UI Actions and Declarative Actions on a Next Experie... 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

View solution in original post