ACL is not working as expected for user with a specific role

Rhonda9
Tera Expert

Hello,

 

I am having an issue with a create ACL.  It is partially working, it works on the work order task table but not the  SM_part_requirement table from the Work Order.  I click on part requirements>New from the work order and it allows the user with the custom role "director" to create Part Requirements.    I want to restrict this role from creating part requirements.  How can I accomplish this.  It does not seem to be working with the script below.  The restriction does work for the work order task but not the work order. 

Any assistance would be greatly appreciated.

 

Rhonda9_1-1701354662274.png

 

 

var sc = new sn_sm.SMConfiguration();
var task = current.service_order_task.getRefRecord();
if (task.getTableName() == 'wm_task')
 
answer = sc.hasRole(task, 'qualifier,dispatcher,agent');
else
answer = sc.hasRole(task, 'read');

 

4 REPLIES 4

H S B
Giga Guru

Can you please help me understand under which module these tables are part of?

Also have you created this ACL from scratch or it was existing ?

Rhonda9
Tera Expert

Hello,

These tables are part of Field Service Management .  The Parts Requirement is a related list on the work order and work order task form.    This is a modification to an existing ACL. 

 

 

 

 

Assuming you have not modified the SCRIPT part of the acl as well, I would suggest to check if there is any other CREATE acl as well on 'Parts Requirement' table as if that ACL is allowing that particular role to create record, this ACL won't be overriding that behaviour.

 

Also within this ACL script, you can write down a gs.log(answer) in each if/else statement & see what values you are getting when you try to create a record in Parts Requirement under Work Order & under Work Order Task both separately, it will give you some idea.

Rhonda9
Tera Expert

I did check to see if there was another Create ACL allowing this but there is not another for the parts requirements table.   I also tried removing the else statement and it seemed to work but it restricts for all, including myself as an admin.     Scripting is a challenge for me.