Assigning field permission level dynamically

Is it possible to assign perm level to field dynamically?

My scenario is like below:

We have two types of quotations, Budgetary and Firm.

Sales Users create the quotations, for budgetary quotations prices are filled by them. Sales Users can see quotations created by them (Owner restriction), Sales Manager can see all the quotations.

For firm quotations(these are mostly govt tenders and are price sensitive), the quotation is created by sales user but the prices are filled by HOD.
My requirement is that the Sales User (owner) or sales manager should be able to see the quotation but not the price for firm quotations.

If I use permission levels, then the price fields of quotations of both types will be not visible to sales users, which I don’t want.

Is it possible to set the permission levels as below:
(Here enquiry_stage is a custom field of type Select with two options as Draft and Budgetary)

If doc.enquiry_stage == “Budgetary"
Set permission level = 1

If doc.enquiry_stage == “firm" and doc.status == “Draft”
Set permission level = 1

If doc.enquiry_stage == “firm" and doc.status == “Submitted”
Set permission level = 2

Is its possible this way or please suggest if there can be any other workaround.

Thanks
Rasika

@rasika25021

You can use frm.set_df_property("price_field", "permlevel", 1, frm.doc.name, "table_field_if_a_child_table")

However, this will only affect the browser side view. It won’t affect the server side validation.

-Anand.

@rasika25021
Not what you asked, but why don’t you create two “price” fields, each shown only with Budgetary or Firm. For the price field linked to Firm, you can set the field level permissions.

1 Like

@anand

“However, this will only affect the browser side view. It won’t affect the server side validation.”
Can you please elaborate on this?
The only requirement is that the sales users should not be able to see the price related information if the quotation type is firm.