Hide section in form based on role

-Andrew-
Kilo Sage

Hi there,

 

Does anyone know how to hide a section in a form based on their role?

 

I am trying to hide the section "Service_Incident" to all users, only visible to users with the role " LegalServices_Manager"

 

I have tried the client script below without joy. Any help most welcome.

 

if(g_user.hasRole('legalservice_manager'))

{

g_form.setSectionDispaly('Service_Incident',true); 

}

 

 

1 ACCEPTED SOLUTION

Elijah Aromola
Mega Sage

That should work, you do have a typo though. Try:

if (g_user.hasRole('legalservice_manager')){
    g_form.setSectionDisplay('Service_Incident', true);
} else {
    g_form.setSectionDisplay('Service_Incident', false);
}

Please mark this as correct/helpful if it resolved your issue!

View solution in original post

3 REPLIES 3

Elijah Aromola
Mega Sage

That should work, you do have a typo though. Try:

if (g_user.hasRole('legalservice_manager')){
    g_form.setSectionDisplay('Service_Incident', true);
} else {
    g_form.setSectionDisplay('Service_Incident', false);
}

Please mark this as correct/helpful if it resolved your issue!

AbhishekGardade
Giga Sage

Try below code:

if(g_user.hasRole('legalservice_manager')){
 
g_form.setSectionDisplay('service_incident',true);

}
IMPORTANT NOTE :
The section name is lower case with an underscore replacing the first space in the name, and with
the remaining spaces being removed, for example "Section Four is Here" becomes "section_fourishere" . Other non-alphanumeric characters, such as ampersand (&), are removed. Section names can be found by using the getSectionNames method."

Refer this :

Show/Hide Form Section by Name

Please mark as Correct Answer and Helpful, if applicable.
Thanks!
Abhishek Gardade
Hexaware Technologies

Thank you,
Abhishek Gardade

-Andrew-
Kilo Sage

Both very helpful, thank you very much.