How to give the display depends on based to role

I am using this eval:frappe.user.has_role(‘QA Manager’) && doc.pending_qa_approval == 1
but its not working
help me out

You can restrict via Perm level in the docfields.

Then allow only QA Manager role to read and write on that perm level.

its not working

Use this below method to display depends on based on role
eval:frappe.user.has_role(“System Manager”)

Are you sure we have access to frappe object in eval of depends on? I have only tried doc object untill now.

By the way… the better way to do is via field level permissions as suggested by @root13F.

Hello, @arokia
You should give @root13F 's suggestion a shot. Check out this link

Do you have an updated version of the expression? :smiley:

Hi @jaichavan am trying to set eval for field so I didn’t use role permission. Can you suggest for field level.

Field level restrictions can be applied using Perm Level. Check this link for the same:
https://docs.erpnext.com/docs/user/manual/en/setting-up/articles/managing-perm-level

Hope this helps.

2 Likes

@iMoshi Did you get updated version of expression eval:frappe.user.has_role(“System Manager”)?

This is what I have as a snippet (I’ve used this in v13):

eval:frappe.user.has_role('Administrator')

Thanks. I was able to make the same work earlier. I didn’t refresh the page after updating the column.