- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2018 06:48 PM
I created a form and I want to make all field read-only for those with a certain role. I'm new to this and was wondering the best approach.
Thanks.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2018 11:19 PM
Hello Randy@RL,
Best practice for your requirement is that Use ACL ,
In Write ACL you have to give role only to which you want to give access to a user who having particular role .
For Example If a user with ITIL role can edit all fields in the table other than that cant edit.
so i will go to ACL table and select table on which i want give permissions to edit.
select 'Write' ACL in that Click on the advanced write code .
Code in Advanced section of ACL
if(gs.hasRole('certain role you want add'))
{
answer = false;
}
else {
answer = true;
}
Test User doesnt have ITIL role So all fields are read only for him.
Thank you.
PLEASE mark my ANSWER as CORRECT if it served your purpose.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2018 07:11 PM
you can create onLoad client script that check logged in user role
function onLoad() {
if (g_user.hasRole('xyz')){
g_form.setReadOnly('your field', true);
}}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2018 07:13 PM
Hello Randy,
If field security needs to change as a form is being filled out, use UI policies and client scripts, which are evaluated and run on the client, that is, the browser. For example, when a support engineer changes the incident state to resolved or closed, one or more fields change from editable to read-only to prevent additional changes.
Note: Client-side security with UI policies and client scripts is not as secure as server-side security. Most modern browsers allow users to change attributes of the data sent to the client, including read-only or hidden fields.
If the data is not dynamically changing on the form, that is, the read-only or edit attribute does not change after the form is loaded, ACLs are recommended. ACLs are evaluated and enforced entirely on the server, making them much more secure than UI policies and client scripts.
Thanks,
Pradeep Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2018 11:19 PM
Hello Randy@RL,
Best practice for your requirement is that Use ACL ,
In Write ACL you have to give role only to which you want to give access to a user who having particular role .
For Example If a user with ITIL role can edit all fields in the table other than that cant edit.
so i will go to ACL table and select table on which i want give permissions to edit.
select 'Write' ACL in that Click on the advanced write code .
Code in Advanced section of ACL
if(gs.hasRole('certain role you want add'))
{
answer = false;
}
else {
answer = true;
}
Test User doesnt have ITIL role So all fields are read only for him.
Thank you.
PLEASE mark my ANSWER as CORRECT if it served your purpose.