Alert Message in report screen

I want to show message like it in report screen. how can i do it?

Hi @gelveri,

That for, Please apply the client script for Report DocType.

frappe.ui.form.on('Report', {
	refresh: function(frm) {
		let msg = __(
			"This site is running in developer mode. Any change made here will be updated in code."
		);
		frm.dashboard.add_comment(msg, "yellow", true);
	}
});

Output:

Thank You!

2 Likes

Thank you @NCP for your answer.
But I don’t want to do this in Report Doctype.

I want to do this in the custom report I created.

Hi @gelveri,

If your report is Custom Server Script then please apply to the report.js file.
Here, we share some syntax. please check it.

frappe.query_reports["Test"] = {
	"filters": [
		{
			"fieldname":"company",
			"label": __("Company"),
			"fieldtype": "Link",
			"options": "Company",
			"default": frappe.defaults.get_user_default("Company"),
			"reqd": 1
		},
	],
	"onload": function(report) {
		$(document).ready(function() {
			// Add content after the report title
			var reportTitle = $(".page-title");
			var additionalContent = $("<p style='color:#975a16;'><br>This is additional content after the report title.</p>");
			reportTitle.after(additionalContent);
		});
	}
};

Output:

It only worked on the Custom Server script report side.
I hope this helps.

Thank You!

2 Likes

Thanks bro. You are great.
Maybe you can help me how to hide this field. :smile:

I tried these two;

$(‘.col-md-12 span’).parent().parent().parent().addClass(“hide”)
or
$(‘.col-md-12 span’).parent().parent().parent().hide()

But not working.

it worked in chrome console but not working in report.js file

my report.js;

Please try it.

$('.report-footer.text-muted').hide();

still not working in onload. but working when try in chrome console.

Hi @gelveri,

Please apply it.

setTimeout(function() {
	$('.report-footer.text-muted').hide();
}, 1000);

Then reload and check it.

Thank You!

1 Like

I set meaningful translations for that fields. You can also set them as empth with translation.