How do I hide a related list TAB in case the user is not a member of a specific assignment group?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2023 07:45 AM
Hello Community,
I have found various articles about how to hide a related list under some conditions, but did not find anything helpful about how to hide ONE tab from a related list, in case the logged in user is NOT a member of a specific assignment group:
The idea of our architect is to do this with a UI policy, which I scripted like this:
function onCondition() {
//get the sys property of the specific assignment group
var portfolioGroup = gs.getProperty('ppm.portfolio.group');
//get the logged-in user's user ID
var userId = gs.getUserID();
//c
var isMember = false;
var groupMember = new GlideRecord('sys_user_grmember');
groupMember.addQuery('user', userId);
groupMember.addQuery('group', portfolioGroup);
groupMember.query();
if (groupMember.next()) {
isMember = true;
}
//name of the project budget tab
var projectBudgetTab = 'project_funding';
g_form.setSectionDisplay(projectBudgetTab, isMember);
}
Then I set the UI Policy Related List Action like:
project_funding.task visible: True
Can someone give me advice please?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2023 07:59 AM - edited ‎09-22-2023 08:00 AM
Hi @Community Alums,
Try this in an onLoad client script:
function onLoad() {
//get the sys property of the specific assignment group
var portfolioGroup = gs.getProperty('ppm.portfolio.group');
//name of the project budget tab
var projectBudgetTab = 'project_funding';
//get the logged-in user's user ID
var userId = gs.getUserID();
//c
var isMember = false;
var groupMember = new GlideRecord('sys_user_grmember');
groupMember.addQuery('user', userId);
groupMember.addQuery('group', portfolioGroup);
groupMember.query();
if (groupMember.next()) {
isMember = true;
g_form.showRelatedList(projectBudgetTab);
}
else{
g_form.hideRelatedList(projectBudgetTab);
}
}
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2023 08:35 AM - edited ‎09-22-2023 08:37 AM
Hi @Community Alums You can achieve it with a Onload Client Script by calling Group validation from Script include as Below:
ClientScript:
function onLoad() {
var ga = new GlideAjax('checkGroupMember'); // Script Include Name here
ga.addParam('sysparm_name', 'checkGroup'); // Your Function Name here
ga.getXML(valdiateGroup);
function valdiateGroup(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(typeof answer);
if (answer == 'false') {
g_form.hideRelatedList('incident.parent_incident');
}
}
}
Script Include:
var checkGroupMember = Class.create();
checkGroupMember.prototype = Object.extendsObject(AbstractAjaxProcessor, {
checkGroup : function(){
var grp = gs.getUser().isMemberOf('477a05d153013010b846ddeeff7b1225');
return grp;
},
type: 'checkGroupMember'
});
I had tested the above in my PDI with the Exact configuration it was working
Before User is not a member of the Group:
After adding the member to the Group:
You can observe that Child Incident Related List Hidden in Case-1 was shown after adding the Group in Case-2
Thanks & Regards,
Eswar Chappa
Mark my answer correct and Helpful if this helps you 😀