Hi All,
I had a field name in Sales Stage label{custom_stages}fieldname in deal(opportunity) doctype i need sales user not to show “Closed Won”, “Closed Lost” options for sales user but i need to show for system manager
Thanks in Advance
Hi All,
I had a field name in Sales Stage label{custom_stages}fieldname in deal(opportunity) doctype i need sales user not to show “Closed Won”, “Closed Lost” options for sales user but i need to show for system manager
frappe.ui.form.on('Opportunity', {
onload: function(frm) {
if (frappe.user.has_role("System Manager")) {
return;
}
else if (frappe.user.has_role("Sales User")) {
frm.fields_dict['custom_stages'].df.options = frm.fields_dict['custom_stages'].df.options.split('\n').filter(function(option) {
return option !== "Closed Won" && option !== "Closed Lost";
}).join('\n');
frm.refresh_field('custom_stages');
}
}
});
By using this script you can hide options