How to add indicator colors to custom fields

I want to create custom indicators for different options,
I tried the following script, script displaying color indicators but in the status field, I want to add this somewhere else (for party_type, see below screenshot)

get_indicator: function(doc) {
	if (doc.party_type === "Supplier") {
		return [__("Supplier"), "green"];
	} else if (doc.party_type === "Vendor"){
		return [__("Vendor"), "blue"];
	}
}

image

How to do this?

1 Like

A little bit late but I have used this code:

(function () {
    frappe.ui.form.on('Delivery Note', {
        refresh: function (frm, cdt, cdn) {
            console.log('ok')

            frm.set_indicator_formatter('item_code', function (doc) {
                return doc.docstatus == 1 || doc.qty <= doc.actual_qty ? "green" : "orange";
            });
        }
    })
})();
1 Like