- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 01:54 AM
Hello Experts,
I have requirement to make cancel comments mandatory on click of UI Action which is visible on Service Portal only for Self-service and Service Portal view.
So when cancel UI action is clicked the additional comments must become mandatory and on filling that then incident should get cancel.
Below is the code. Please advice how can we achieve it.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 07:00 AM
UI actions created on table are shown on form
You cannot show client side UI action i.e. Client checkbox=true in portal form view.
you can use only server side UI action on portal
So make your UI action as server side and it will work both in native+ portal form view
Uncheck client checkbox and remove Onclick field
if(current.comments == ''){
gs.addErrorMessage("Please populate comments");
return false;
}
else{
current.incident_state = 8;
current.state = 8;
current.update();
action.setRedirectURL(current);
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 02:29 AM
Hello @Ankita Gupte
Basically UI action works at both Server and client side. The checkbox "client" in the UI action form tells if any client side function needs to be run if the UI action is clicked. When client checkbox is checked, new field will be visible where you need to give function name which runs at client side.
In your UI action, make the client as true, and give cancelIncident() as onclick function. Then use below script in UI action script:
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 02:41 AM
Hi Ali,
Thank you for quick update but when I click on client as true then the UI action is not visible on Service Portal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 04:08 AM
Are you using form page in portal or standard ticket page, to show the incident to end users?
Thank you,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 06:56 AM
Hi Ali we are using it on ticket form