How to create a custom cancel UI Action in case table

Gopal14
Tera Contributor

Hi Team,

 

How to create a custom cancel UI Action in case table for native view and workspace view

1 ACCEPTED SOLUTION

@Gopal14 

you need to write script in workspace client script.

if (g_form.getValue('comments') == '') {
g_form.setMandatory('comments', true);
g_form.addErrorMessage("You must add a reason in Additional comments in order to reopen an incident");
return false;
}

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

View solution in original post

19 REPLIES 19

Viraj Hudlikar
Tera Sage

@Gopal14 

Check this video https://youtu.be/Fjg-f1ABQJ4?si=U_KblkDJRHSiTg1y

If still any blocker do let us know.

 

If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.

 

Thanks & Regards
Viraj Hudlikar.



 

Ankur Bawiskar
Tera Patron
Tera Patron

@Gopal14 

You should be able to do this and it's simple.

you will find lot of OOB Cancel UI actions configured for native and workspace

what did you start with and where are you stuck?

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

HI @Ankur Bawiskar 

 

I have created UI Action,

 

Below is my code.

condition is : current.state != 7;

 current.state = 7;
    current.update();
    gs.addInfoMessage('The case has been successfully canceled.');
    action.setRedirectURL(current);
 
code is working fine in native view.
 
I have checked Workspace form button checkbox.
 
cancel button is not visible in the workspace view.  Do I need to make any other changes

@Gopal14 

these 2 checkboxes should be true so that the button component is created for workspace

If unchecked, then check both and save and then verify

AnkurBawiskar_0-1738238101381.png

 

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