Create a cancel button in SOW

Somnath_snow
Tera Contributor

'How to  just create a cancel button to cancel a incident in any state. It should stay on the same page after cancellation in SOW". 

I am confused which api to use, "g_aw. " or "g_modal." . A solution to this would be very helpful.

5 REPLIES 5

shyamkumar VK
Kilo Patron

@Somnath_snow ,

Refer to this Below Links 

 

https://www.servicenow.com/community/next-experience-articles/how-to-use-ui-actions-in-workspaces/ta...

 

https://www.servicenow.com/community/next-experience-blog/workspace-for-a-custom-app-buttons/ba-p/26...

 

Regards,

Shyamkumar

 

Please mark this as helpful and accept as a solution if this resolves your Ask.
Regards,

Shyamkumar

shloke04
Kilo Patron

Hi @Somnath_snow ,

 

OOTB cancel button is not available on Incident table for both Native and SOW. You can create one like regular how you create an UI action and have the below settings highlighted in yellow updated to have it in workspace as well:

 

Script:

current.state=8;
current.update();
action.setRedirectURL(current);

Sample Screenshot:

shloke04_0-1709795952739.pngshloke04_1-1709795963242.png

 

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Yes that's correct. But i want the button in SOW. Would you please enlighten on that.

@Somnath_snow ,

 

Steps mentioned above will work for SOW as well. Please follow the steps highlighted in my solution above, also refer to screenshots which contain all the details.

Attaching here again for reference:

1. Create a UI Action on Incident table.

2. Update the script of the UI Action as mentioned above in my post.

3. Make sure to update the field "Workspace Form button" as true in the UI action form record as shown below:

shloke04_0-1709803815045.png

 

Result:

shloke04_1-1709803846638.png

Once you click the state of on incident record, state of incident will go to cancelled and redirect back to the same page again.

 

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke