Status indicators (for child table) in custom doctypes?

Hey,

I am trying to add status indicators to field in a custom doctype in a childtable (per table row). I have found this How to add indicator colors to custom fields But it only seems to apply to list views. I have tried using the set_indicator_formatter function and so on…

Anybody knows how to get indicators for fields (in childtables) ?

Just for those of you who don’t know about the thing:

Delivery Note has these indicators in a child table.

4 Likes

Hello @Canlann

Have you figured out how to do this for a custom DocType and it’s child table?

Hi Eugene. You would do it exactly the same way as listed above. As an example, say you were to modify the stock reconciliation document so that you had a green indicator when you increase stock and a red indicator when you decrease it:

frappe.ui.form.on("Stock Reconciliation", {
    refresh(frm) {
        frm.set_indicator_formatter("item_code", (doc) => {
            if (doc.quantity_difference > 0) {
                return "green"
            } else if (doc.quantity_difference < 0) {
                return "red"
            }
            return "grey"
        })
    }
});