ERPNext Conference 2019* ERPNext.com Blog

Permission By Field


#1

Is it possible to give doctype permission by field

Example:
Consider a Doctype with a field Reviewer.
If I create this form and select a user in the Reviewer, I want the document permission visible only to the Reviewer whom I selected in the doc and Owner (which is myself).


#2

Hello,

Please refer
https://erpnext.org/docs/user/manual/en/setting-up/articles/managing-perm-level?
Once you set field level permission, under role permission you can set
Apply User Permissions and Select Document Types.

Hope this helps.


#3

Hi,

Okay… I am not looking to set permission to a specific field.
I am looking to set permission to a doctype, based on the field value.

Let’s take the Leave Application itself,
Consider we have an doctype leave application which contains the field, approver.
Now Lets say we have 5 Leave Approvers and I can choose any one while filling up the form.

Once I select an approver. This Leave Application which I am going to submit must be visible only to the approver whom I selected.

This Application Should not be visible to other approvers.
If I set Doctype permissions to the Role Approver, all of the approvers are able to view the form. But I want is that only the approver whom I select in the form should be able have read write access. How do I achieve this. ?


#4

Have you found a solution to this?


#5

Hello @Joses_Paul This feature is not available out of the box yet. You can keep the doctype Leave application accessible to the users but if you want only 1 user to be allowed, then make the other users to have only Read-only access and not edit permissions.


#6

@Yousef @Joses_Paul @Mitali_Deshpande @grh

I think this can help :


#7

I’m looking into at at the moment, writing a custom code on the server
I hope it works


#8

@Yousef @Joses_Paul

Have you find any solution to this?
even I need something like this.


#9

Tried custom logic through doctype permissions hook ?

https://frappe.io/docs/user/en/guides/basics/hooks


#10

With all the improvements in ERPNext, there should be a straightforward way to handle this scenario by now… Even if it’s a whitelisted method that can be called from the client side

Kind regards,