Help with "Mandatory Depends On"


In my items doc I’m trying to get the field “MTR” (a custom field) to be mandatory if field “Item Group” equals “Raw Material”

Can someone give me the the entry in “Mandatory Depends On” please?

I spent awhile trying self help on this but could not find any instruction or documentation that explain the syntax for these “Property Depends On” entries. A bit frustrating in that they seem like really useful features of ERPNext. To understand how to use these features, where does one go to learn?

Thank you!

Hi @WIE,

Please apply in custom field of Mandatory Depends On.

eval:doc.item_group == 'Raw Material'

If Item Group == Product then Mandatory does not show

If Item Group == Raw Material then MTR Mandatory show.

I hope this helps.
Thank You!

1 Like

Thank worked perfectly! Thank you!

So how does one know to use single quote vs double ’ vs ", or two equal signs?

Is this Frappe syntax or Python? Just wondering what I should trying to learn.

Thanks again

You can use single quote or also use the double quote.

eval:doc.item_group == 'Raw Material' is written in Frappe’s client-side JavaScript code.

Thank You!


Hi. How does this work if you check if the input only contains certain expression?

For example


I am getting error message that this expression is invalid.