Give write access to a particular field in the form

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2023 05:55 AM
Hi,
I've requirement to give 'write' access to the user having a particular role to 'Risk Score' field available in "sn_vul_vulnerable_item" table. Please see the screenshot as below (by default this field is read-only):
I've created a role called "sn_vul.vit.riskscore" and an ACL called "sn_vul_vulnerable_item.risk_score" for this. Please see the screenshot as below:
If I'm giving this particular role to the user, still user doesn't have access to edit 'Risk score' field.
Let me know if I'm missing anything or any other action item needs to be taken care.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2023 03:51 AM
Hi @Bijay Kumar Sha ,
If you have copied same script, then sorry there was one small mistake, it will be hasRole().
Also, use backend value of manual (choice). If value of manual is integer i.e. 1 or 2 then write it like mentioned below:
function onLoad() {
var ga=g_form.getValue('source');
if(g_user.hasRole('sn_vul.vit.riskscore')&& (ga=='1'))
{
g_form.setReadOnly('risk_score',false);
}
else
{
g_form.setReadOnly('risk_score',true);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2023 07:52 AM
Hi @Bijay Kumar Sha ,
Please Try below Scenario i will help to solve your solution.
You need to make 4 ACL to complete this task.
1st step > table_name.none (operation=read) {give 2 role A & B}
2nd step > table_name.none (operation=write) {Role = A & B}
3rd step > table_name.field_name (operation=write) {Role = A} [field_name=select name of the field that you want in write mode.]
4th step > table_name.* (operation=write) {Role = B}
After complete this , give Role A to the Group or User whom you want to show one field in write mode.
Please mark as helpful/correct if it solves your issue.
Regards,
Kalyan