How to create ACL on Extended fields

Ram141
Tera Expert

Hello All,

I got a requirement to set one field on the form to readable state for specific user role on the child table , to create write acl on that particular field could see that the field is extended from parent table.

 

Ex:

Child table : Workplace

Child table field: Start date (Extended from Parent table Reservations)

 

Could someone please guide me here to accomplish this one.

Thanks,

Raj

 

 

5 REPLIES 5

Ed13
Tera Contributor

You can try to create an ACL for the specific field only.

Thereby you should have 2 ACL`s one that provides access to the table, if you do not have that already, and the second one that targets the desired field name the table name should be the child one.

Then you can link the ACL with the role.

find_real_file.png

 

Musab Rasheed
Tera Sage
Tera Sage

Hi Ram,

Simply write onload client script on child table and if that works like below and don't touch ACLs.

function onLoad()

{

if(g_form.hasRoleExactly('nameofrole'))

{

g_form.setReadOnly('nameoffield', true);

}

else

{

g_form.setReadOnly('nameoffield', false);

}

 

Please hit like and mark my response as correct if that helps
Regards,
Musab

Ram141
Tera Expert

Hello Rasheed & Ed,

Thanks for the reply.

I'm going ahead with client script only as the restriction is on form level.

I have written the below script but I'm not getting alert also and the field is not setting Readable / Readonly based on roles.

function onLoad() {
//Type appropriate comment here, and begin script below
if(g_form.hasRoleExactly('sn_wsd_case.manager'))

{
alert('mgr');
g_form.setReadOnly('start', false);
g_form.setReadOnly('end', false);

}

else

{
alert('not mgr');
g_form.setReadOnly('start', true);
g_form.setReadOnly('end', true);
}
}

 

There is one Ui Policy which is making the field(start) Readonly i set it to Leavealone.

Not sure why the client script is not working could you please help me here.

Thanks,

 

 

 

Thank you, I got to know we have to use g_user to check the role.