Based on the group member Hide the sections
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2024 01:56 AM
Hi Team,
I have three groups of members I need to hide the sections. Those group getting from system property
For this I have write onload client script and display business rule.
I need hide the sections based on login user
Client script
function onLoad() {
//Type appropriate comment here, and begin script below
// // var sec = g_form.getSections();
var grpmember = g_scratchpad.hideSections;
if (grpmember) {
var grpArr = grpmember.split(',');
if (grpArr.includes(g_scratchpad.groupvertical)) {
g_form.setSectionDisplay('executive_notification', false);
}
}
}
Business rule
(function executeRule(current, previous /*null when async*/) {
// Add your code here
g_scratchpad.hideSections = gs.getProperty('xoc.incident.show_exec_notification');
g_scratchpad.groupvertical = current.assignment_group.parent.getDisplayValue();
})(current, previous);
system property with group names:
But still not working as expected . Could you please me on this issue
Thank you in advance
Vijay
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2024 11:38 PM
try this
(function executeRule(current, previous /null when async*/) {
// Add your code here
var gr = new GlideRecord("sys_user_grmember");
gr.addQuery("user", gs.getUserID());
gr.addQuery("group.sys_id", "IN", gs.getProperty('xoc.incident.show_exec_notification'));
gr.setLimit(1);
gr.query();
g_scratchpad.isMember = gr.hasNext().toString();
}(current, previous);
onLoad client script
function onLoad() {
if (g_scratchpad.isMember == 'true')
g_form.setSectionDisplay('executive_notification', false);
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards,
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader