ServicePortal alert messages for user's without manager
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi All,
I have a requirement that, if user doesn't have line manager updated for him in user table, then he shouldn't be able to submit any form in service Portal.
There should be a Alert message when he opens any form there should be pop up to contact line manager to raise a request on behalf.
Please let me know the best way to achieve this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
then why not hide those catalog items using User Criteria.
In User Criteria use advanced script and see if logged in user has manager or not
Then Add this User Criteria in Available for Related list of your catalog item
Apply user criteria to items and categories
var gr = new GlideRecord("sys_user");
gr.addQuery("sys_id", user_id);
gr.addNotNullQuery("manager");
gr.query();
answer = gr.hasNext();
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
another way is to use onSubmit + glideAjax and see if logged in user has manager or not
If not then stop form submission
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
another way is this
1) create a hidden single line text variable with this default value in it, store logged in user's manager in that
javascript: gs.getUser().getManagerID();
2) then use onSubmit client script and check if that variable is empty, it means no manager then stop form submission
function onSubmit() {
var hiddenVariableValue = g_form.getValue('hiddenVariableName');
if (hiddenVariableValue == '') {
g_form.addErrorMessage("You cannot submit form as you don't have line manager");
return false;
}
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
