Hide/show choice value based on groups
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2024 11:48 PM - edited ‎08-29-2024 11:51 PM
Hi all,
Below is the requirement-
There is a choice field with values A, B and C.
1. Requirement 1- Value C should be available for selection to only members of group 1 and group 2.
That means group 1 and group 2 members can see all the 3 choice values- A,B and C and the users who are not members of group 1 and group 2 can see only 2 choice values- A and B.
2. Requirement 2- When a member of group1/ group2 selects value C in the choice field and saves the record and when a user who is not a member of the group opens the record, then the user should see value C as read only in the choice field
In short- non members should not have value C available for selection, but when value C is already added in the choice field by member then it should be shown in the choice field but it should be read only.
I have achieved requirement 1 by using onload client script and script include but the issue is when value C is already added in a record and when non members open the record, the value shown in choice field is None.
Not sure how to achieve both requirement 2 along with requirement 1 as both seems a bit contradictory to me.
Can someone help me achieve both the requirements?
@Ankur Bawiskar Your help is highly appreciated
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2024 12:25 AM
Hi @Rose17 ,
After achieving first requirement, to get the second requirement
Create a new on-load client script
Call a GlideAjax to know a member is part of the selected group
If Yes,
return
Else,
var ans = g_form.getValue('field');
if(ans == 'c'){
g_form.setReadOnly('field');
}
Hope this information helps.
Regards,
Najmuddin.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2024 12:29 AM
@Rose17 You can't make a specific choice read only in the select box. Only the entire field can be made read only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2024 03:43 AM
Hi @Rose17,
You may try with the following client script and script include:
Client Script :
Attaching screenshot for reference.
Please mark my response as correct and helpful if it helped solved your question.
Thanks,
Rohit Suryawanshi