Is there a way to make a section / tab of a form available, depending on the group?

sumana1707
Mega Contributor

Dear All,

Is there a way to make a section / tab of a form available, depending on the group?

Suppose, I am a member of ABC group. I log into the system and opens a particular form, which has 5 sections / tabs for 5 different group members. As per my requirement, when I log into the system and open the form, it should automatically select the ABC tab / section (say, it is the 3rd section / tab in the form), so that user need not to click on different tabs before opening the tabs related to his group.

Any help on this would be much appreciated.

Regards,

Sumana

1 ACCEPTED SOLUTION

Hi Sumana,



You can do it with a UI policy and a script include.


Script include:


Name: findUserGroup


Client callable: yes


find_real_file.png



UI Policy:



find_real_file.png



Several small things to note:


1. The line with the sys id: you can return the group name from the script include. However, if you change the group name for some reason, you will also have to change the ui policy script.


2. You will have to repeat lines 11-12 for each group, wahc each with its sys_id and position on the page.


3. The user must be in only one of the 5 groups, or, if in more than one, then the focus would be on the first group encountered. If you want to go through all of them, you'd need an array in the GlideAjax, and to split the array in your ui policy and find the right group.



harel


Edit:


I am sorry for the screen shots. When I try to paste the text itself, I get an error:


Your content could not be saved due to an error. You may have been logged out. If this problem persists please contact your system administrator. Click here to refresh this page.


View solution in original post

5 REPLIES 5

Patrick DeCarl1
ServiceNow Employee
ServiceNow Employee

Check out link below but also look for the function on the developer site.




GlideForm (g form) - ServiceNow Wiki


Geoffrey2
ServiceNow Employee
ServiceNow Employee

I would solve this by using a Business Rule to check group memberships with isMemeberOf, and populate the results into the scratchpad. Then use an onLoad Client Script to hide or show the sections:


capture1.png



capture.png


Hi Geoffrey,



Thank you for the reply. But i do not want to make any section hidden. All 5 sections will be visible to all the group members but I want the section, to remain selected when any user of that particular group logs in.


For example, if I am a 'service desk' group member and i log into the system & open the particular form, the 'service desk' section (may be the 3rd tab / section in the form) will be selected for me for filling up the data but i can also click on other 4 tabs to see the data in those sections.



Please let me know if you need any further clarification.



Regards,


Sumana


Hi Sumana,



You can do it with a UI policy and a script include.


Script include:


Name: findUserGroup


Client callable: yes


find_real_file.png



UI Policy:



find_real_file.png



Several small things to note:


1. The line with the sys id: you can return the group name from the script include. However, if you change the group name for some reason, you will also have to change the ui policy script.


2. You will have to repeat lines 11-12 for each group, wahc each with its sys_id and position on the page.


3. The user must be in only one of the 5 groups, or, if in more than one, then the focus would be on the first group encountered. If you want to go through all of them, you'd need an array in the GlideAjax, and to split the array in your ui policy and find the right group.



harel


Edit:


I am sorry for the screen shots. When I try to paste the text itself, I get an error:


Your content could not be saved due to an error. You may have been logged out. If this problem persists please contact your system administrator. Click here to refresh this page.