- 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 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-18-2023 11:31 PM - edited 09-18-2023 11:31 PM
Thank You @Ankur Bawiskar. You are a star ⭐