Hello,
I have two fields:
- First is called Item Intention, which has the field name custom_item_purpose
- Second is called Usage Classification, which has the field name custom_usage_classification
Item Intention has two options, “To Manufacture” and “To Purchase”. Depending on the selection I want to remove the option “Sundry” from the “Usage Classification” select dropdown.
I am trying to follow the example given in the docs (the example of which seems to have errors as it’s missing a comma after the set_field_options
)
https://docs.erpnext.com/docs/user/manual/en/filter-options-in-select-field
But it is not working, all options appear in the “Usage Classification” field regardless of choice.
Code is below, can anyone see where I am going wrong?
if(frm.doc.custom_item_purpose == "To Manufacture") {
set_field_options("Usage Classification", ["Development","Investigation","Production"]);
}
else if(frm.doc.custom_item_purpose == "To Purchase")
{
set_field_options("Usage Classification", ["Development","Investigation","Production","Sundry"]);
}
else if(frm.custom_item_purpose == "")
{
set_field_options("Usage Classification", ["Development","Investigation","Production","Sundry"]);
}
});
I had tried replacing Usage Classification with custom_item_purpose in the code but it didn’t seem to make any difference.
Thanks,
Paul