Displaying Custom Status in Title Bar for Submitable Doctype (Instead of Draft/Submitted)

Hello

I’m working on a custom doctype that is submitable. By default, the title bar for submitted documents shows “Submitted” (or “Draft” if not submitted). I have a custom status field (e.g., status) in this doctype, and I’d like its value to be displayed in the title bar instead of the default “Draft” or “Submitted” text.

For example, if my custom status field has values like “Acknowledge”, “Outsource”, or “Result Entry”, I want these to appear in the title bar.

How can I achieve this?

at document customize-> View Settings->place field name of status.

hello @Naveed1

Thank you for your response but It is the title field, and I want to display it instead of the draft and submitted statues.


I have found solutions for this issue here.

custom_doctype.js:

frappe.ui.form.on("Custom Doctype", {
	refresh(frm) {
        frm.page.set_indicator(`${frm.doc.status}`, get_status_color(frm.doc.status));
	},
});

function get_status_color(status) {
    const colors = {
        "Pending": "orange",
        "New": "blue",
        "In Progress": "purple",
        "Completed": "green",
        "Cancelled": "gray",
        "Rejected": "red"
    };
    return colors[status] || "gray";
}

custom_doctype_list.js:

frappe.listview_settings['Custom Doctype'] = {
    add_fields: ['status'], //Your custom status fieldname
    has_indicator_for_draft: true,
    has_indicator_for_cancelled: true,

    get_indicator: function (doc) {
        const status = doc.status || 'Unknown';

        // Status color map
        const status_map = {
            "Pending": "orange",
            "New": "blue",
            "In Progress": "purple",
            "Completed": "green",
            "Cancelled": "gray",
            "Rejected": "red"
        };

        const label = `${status}`;
        const color = status_map[status] || "gray";

        return [label, color, `status,=,${status}`];
    }
};