Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Group based related list

Zosy
Giga Contributor

HI Team , 

There is requirement  to create related list and that related list should be able to access to Particular groups! 

Also there is Field  called regulator this has 2 values  CTC and  SEC

When we select For CTC then the created  related list should be able to access this 2  groups ABC_admin and ABC_ASSISMENT 

and When we select SEC then the created list should be able to access this 2  groups ABC_complience and XYZ _approval

 

I have Created the Related List  however I am looking help to scripting part How can I achive this requirement 

Looking forward your help in this .

 

Thanks In advance .

6 REPLIES 6

hello @Zosy add a double quote at the end the sys_id  also you need to use get value for getting assignment group like below

My bad i gave the wrong syntax

 

if(newValue=="CTC_sys_id" && (g_form.getValue('assignment_group')=="ABC_admin__group_sys_id" ||g_form.getValue('assignment_group')=="ABC_ASSESSMENT_group_sys_id" ))
{
g_form.showRelatedList('your_related_list_name');
}
else if(newValue=="SEC_sys_id_value" && (g_form.getValue('assignment_group')=="ABC_compliance_group_sys_id" || g_form.getValue('assignment_group')=="ABC _approval_group_sys_id"))
{
g_form.showRelatedList('your_related_list_name');
}

}

 

Sagar Pagar
Tera Patron

Hi,

I would suggest to use the UI policy with required condition for assignment group.

In UI policy Related list action you can hide/show the Related lists.

 

Thanks,

Sagar Pagar

The world works with ServiceNow