How to HIDE save(ctrl + s) button from ITIL users on the service portal form ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2022 12:07 AM
I want to hide the save button from itil user and it is only visible to admin role. How to do that in service portal form?
- Labels:
-
Cost Management (ITSM)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2022 12:15 AM
In a base instance, you currently cannot hide the Save button without modifying the form widget, which would require you to clone the widget and then script a condition to check against the State value of the record. One option is to clone the form widget and remove the button entirely, and instead use a UI Action for the Incident table on the form to do a conditional check against the State value. The blue Save button will be gone from the cloned form on the right side, and a new gray Save UI action will appear on the bottom-left for records not equal to 7 (the base instance value for "closed").
Supporting article from HI:
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0647791
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-30-2022 08:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
I know this is old, but I just went through something similar. Except I wanted to hide the OOTB button and have my own.
If you don't have a UI Action with the same name and action name the form will use the global. Create a new UI action on the table you are wanting this functionality on, with the same name and action name. Then just don't check "Form Button" or any of the button checkboxes. This would take the place of the global one and allow you to then make a UI action to have the functionality you want.
The OOTB "Save (Ctrl + s)" UI action is actually the update UI action.
sysid = 42df02e20a0a0b340080e61b551f2909
url = /nav_to.do?uri=sys_ui_action.do?sys_id=42df02e20a0a0b340080e61b551f2909
In the condition field add the following. This means only users with the role "admin" will be able to see it.
gs.hasRole('admin')
-Hope this helps someone, Daytona.
 
 
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
Important Notes :
In **Service Portal**, form buttons are NOT controlled by ACLs or UI Actions unless you explicitly expose them.
You must hide/show the button inside the widget or through a client script.
BEST PRACTICE (recommended):
Use the **spWidget** option in the *SC Catalog Item* or *Record Producer* widget and conditional rendering with gs.hasRole().
imple & Clean (Portal → UI Script inside the widget)
Edit the form widget used in Portal, usually:
• *spModalForm*
• *form*
• *sc_cat_item* (if catalog)
• *sp_record_form*
In the client controller, add:
**** javascript
$scope.data.showSave = gs.hasRole('admin');
OR yoi cancreate a client script:
function onLoad() {
// hide save button for itil, show only for admin
if (!g_user.hasRole('admin')) {
var btn = document.querySelector('button[ng-click="save()"]');
if (btn) btn.style.display = "none";
}
}
Hello i hope that can help
If you find this answer useful, please mark it as solution accepted/helpful
Massimiliano Micali
