How we can provide write access to their own records by using ACL

Ashok59
Tera Contributor

I need to provide write access to hardware table based on owned by field. Could you please assist me on this.

 

Regards,

Ashok.

2 ACCEPTED SOLUTIONS

Hi @Ashok59 ,

 

You can achieve this by creating a write ACL on alm_asset table with None.

U need to select advanced & under script section u can write this script

 

if (current.owned_by == gs.getUserID()){

answer = true;

}

 

Thanks,

Danish

 

 

 

 

View solution in original post

Aniket Chavan
Tera Sage
Tera Sage

Hello @Ashok59 ,

You can give a try to the script below in the write ACL on alm_asset table,

var ownedByUser = current.owned_by.user; // Assuming 'owned_by' is a reference field to the User table

if (ownedByUser == gs.getUserID()) {
    answer = true;
} else {
    answer = false;
}

 

If, despite using the script above, you are still facing issues with access, it's advisable to investigate existing ACLs on the write function that might be conflicting with your new one. Additionally, you can leverage the "Debug Security Rules" feature to identify all ACLs running on the current record. This can help pinpoint any conflicts or interactions between different rules and guide you in resolving the access-related challenges effectively.


This version provides a more detailed explanation of the suggested script and offers additional guidance on troubleshooting and debugging potential conflicts with existing ACLs.

AniketChavan_2-1705822139225.png

 

AniketChavan_0-1705821949528.png

 

Let me know your views on this and Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks,

Aniket

 

 

View solution in original post

7 REPLIES 7

Mark Manders
Mega Patron

Without more information, I assume that there already is read access to the hardware table? Because this could have license impact if not.

Write access can be granted by creating a write ACL and add to the condition field (not via script, which I came across a couple of times the past couple of days): 'owned by' is dynamic 'me'.

Do limit it to certain fields. You don't want someone to change serial numbers and such.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

@Mark Manders 

I assume that there already is read access to the hardware table? - yes, we have read access with ITIL role.

 

my requirement - 

I should provide write access to hardware table records when current logged in user name and owned by field name matches. Could you please assist me on this asap and let me know if required more info.

 

Regards,

Ashok.

 

Ashok59
Tera Contributor

I assume that there already is read access to the hardware table? - yes, we have read access with ITIL role.

 

my requirement - 

I should provide write access to hardware table records when current logged in user name and owned by field name matches. Could you please assist me on this asap and let me know if required more info.

 

Regards,

Ashok.

 

Hi @Ashok59 ,

 

You can achieve this by creating a write ACL on alm_asset table with None.

U need to select advanced & under script section u can write this script

 

if (current.owned_by == gs.getUserID()){

answer = true;

}

 

Thanks,

Danish