How to set intro in doctype?

i want to print alert in doctype when button is click , like right down corner alert and msgprint, alert is appear below the doctype name

i tried ones, but i don’t remember the script and Script API, documentation don’t have that

Hi @nilpatel42,

Please check the documentation.

i checked but which i have tried before and i want to add, it’s not there in this documentation

thank you @NCP

Syntax:

frappe.ui.form.on('DocType', {
    refresh: function(frm) {
        frm.add_custom_button(("Button"), () => {
            frappe.show_alert({
                message:__('Hi, you have a new message'),
                indicator:'green'
            }, 5);
        });
    },
});

not this alert, i am talking about alert which show below doctype name with colorful background

Please share an example or screenshot because you asked about the alert in right down corner and that I provided.

this type of alert, it’s like notification for that perticuler doctype

Please check the syntax:

frappe.ui.form.on('DocType', {
    refresh: function(frm) {
        frm.set_intro(__("XYZ message"));
    },
});
1 Like

can we change colour of background ?

Please check it.

frappe.ui.form.on('Item', {
    refresh: function(frm) {
        frm.set_intro(__("XYZ message"), "blue");
        // frm.set_intro(__("XYZ message"), "yellow");
        // frm.set_intro(__("XYZ message"), "green");
        // frm.set_intro(__("XYZ message"), "orange");
        // frm.set_intro(__("XYZ message"), "red");
    },
});
2 Likes