In a single doctype, I want to give record level permission by user id or a field value. So that different users will access different records. Only Administrator will access all records. Role Permission Manager and/or User Permission is not enough to do this. Because, it will be on same DocType but different records.
Can anyone help me and guide how to write py or js file.
Hi, @mijan1373
There is an option available in Role Permission Manager.
First set the same Role for User in User List Doctype.
enable Only if Creator and Set User Permission. for the same Doctype and Role.
this will restrict users to view records created by other users.
Thanks. I am aware of it. But, I have different role like units, document creator, approver etc. If I check “Only if Creator”, that works at creator role, but not at approver role. What exactly I want that documents created by Unit1 should not be visible to the Users of Unit2.
@mijan1373 humm try this scenario . add some kinda grouping to the doctype , like branches or departments . and then add the branch permission to the user with user permission. this way he can only see doctypes that are linked to that branch .
this is how I did it to show only sales invoices linked to a company
I have Agency > Ministry > Sector and three DocType corresponding to these three.
These are Link Field to Project DocType. I have created permissions for “Agency Officer” and “Agency Head”(both are user) and allowing Agency doctype, applicable to Project doctype.
Now, when I login as “Agency Officer”, the Project list are projects which belongs to my agency, but when I am trying to click on Agency, Ministry or Sector link field, system throw message “Insufficient Permission to Agency” (Ministry/Sector). However, if I create a new Project, the Agency gets correct value, but I can’t click on any link field. They throws above mentioned message.