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

Mohith Devatte
Tera Sage
Tera Sage

hello @Zosy .

you can write an on change client script for this on the regulator field 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '')
      return;
   
if(newValue=="CTC_choice_value" && (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_choice_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');
}

}

please mark my answer correct if it helps you

Some modifications 

I could find out Insted of choice there is Records , I mean CTC and SEC are records which is refering someother table ...

How can i do that ?

@Zosy then if its a reference field you need to compare with sys_id's of the CTC AND SEC Records in that particular table like below

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '')
      return;
   
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');
}

}

MARK MY ANSWER CORRECT IF IT HELPS YOU

Thanks Mohith , Getting below error  could you please check if I am doing it right ?

find_real_file.png