Eval syntax for 'depends on'


I’m trying to write a test for depends on box on a form customization. I can get simple == tests to work,but I need to test for a partial match on a field. How would I write an expression to test if a field starts with a particular value. For example I want to display the field if the item_name field start with ‘720-’.



Use eval:doc.item_name.substr(0,3)== “720”


Thanks for the reply, it seemed to work, but causes problems when trying to save the BoM item.


Give some default value to the filed on which you are using substr function.
Like in this case item_name should have some default value, otherwise it will give error.

@mark1 Mention default value or you can write like this eval:doc.item_name && doc.item_name.substr(0,3)=="720"

1 Like