I need filter based on condition for a field when creating item

Hi All,
i had created three doctypes vertical,product type,license type and i added in item transaction with link field type i need when Product type= GWS, Vertical=Education, License type=Flexible,Annual,Multi-Year only need to show and not to show perpetual for that i need solution


Thanks in Advance

Please learn this.

frappe.ui.form.on(“Item”, {
refresh: function(frm) {
set_license_type_filter(frm);
},
custom_vertical: function(frm) {
set_license_type_filter(frm);
},
custom_product_type: function(frm) {
set_license_type_filter(frm);
}
});

function set_license_type_filter(frm) {
// Apply the filter only when Product Type is GWS and Vertical is Education
if (frm.doc.custom_product_type === ‘GWS’ && frm.doc.custom_vertical === ‘Education’) {
frm.set_query(‘custom_license_type’, function() {
return {
filters: {
“name”: [“not in”, [“Perpetual”]] // Exclude Perpetual option
}
};
});
} else {
frm.set_query(‘custom_license_type’, function() {
return {
filters: {}
};
});
}
}
this code is okk???please check and update if any changes

try it locally, if worked then go ahead :wink:

i think little mistake in code can guide me too solution

Im new to client script can u please help brother