How to show /Hide 'Request something 'in Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago - last edited 4 hours ago
Hi All,
Servicenow Portal 'Request something' should be aviabale if logged in ITIL user is belongs to Claims Group and when one Specific system property is TRUE .
if Person not belongs to Claims group , for them it should be available as regular like others . no limitations show always .
please let me know if it is possible ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
create user criteria for this with script and add that in "Available For" related list for that catalog item
what's the issue faced?
💡 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 || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hi @Ankur Bawiskar
very wired thing is , from same Group , I have selected 4 peoples
I flipped property value True to False vice versa . making changes in system property and If I impersonated with same person again and again result not changing as per system property
Property :
1.FALSE :
impersonated with user AAA : catalog item restricted and got info message also (Success)
2.TRUE :
Impersonated with. same user AAA: Catalog item still restricted
But immediately I Impersonated with BBB user, catalog item is appearing .
I did property change again
FALSE again :
immediately I Impersonated with BBB user, catalog item is disappearing .(GOOD)
TRUE :
immediately I Impersonated with BBB user, catalog item still disappearing .
.
WHY like this ? any suggestions please
User Criteria
gs.addInfoMessage("Result : "+new VisibilityCondition().userCriteria(user_id));
var vc = new VisibilityCondition();
answer = vc.userCriteria(user_id);
Script Include
userCriteria: function(userID) {
// 1. Fail early if no userID is provided
if (!userID) {
return false;
}
// 2. Fetch system configuration property
var isLoggingEnabled = gs.getProperty('trunOn_Off') === 'true';
if (!isLoggingEnabled) {
return false;
}
// 3. Define target roles
var Roles = [
'issues_user',
'wealth_user',
'tracker_user'
];
// 4. Perform an efficient check using GlideRecord
var userRoleGR = new GlideRecord('sys_user_has_role');
userRoleGR.addQuery('user', userID);
userRoleGR.addQuery('role.name', 'IN', Roles.join(','));
userRoleGR.setLimit(1);
userRoleGR.query();
// Returns true if a record exists, false otherwise
return userRoleGR.hasNext();
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
see response from @Aditya_hublikar
💡 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 || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Thanks @Ankur Bawiskar . Kindly help me on below thing.
Regarding user criteria ,
Google search is saying if I take Group, roles and Script. System will always consider SCRIPT and ignores Group, Roles and other fields completely ?
it misconception or it's fact .
