I am in a scenario where I wants to use filter values inside onload function to run a custom script. Script is running fine however filter values are not passing into custom function.
So whats the best way to pass filter value into javascript function.
var d = new Date();
frappe.query_reports["Custom Report"] = {
"filters": [
{
"fieldname":"from_date",
"label": __("From Date"),
"fieldtype": "Date",
"default": new Date(d.getFullYear(),d.getMonth(),1),
"reqd": 1
}
{
"fieldname":"to_date",
"label": __("To Date"),
"fieldtype": "Date"
"default": frappe.datetime.get_today(),
"reqd": 1
}
],
onload: function(report) {
report.page.add_inner_button(__("Send Email"), function() {
return frappe.call({
method: "doctype.doctytyp.report.report.function",
args: {
fitlers: report.filters
},
callback: function(r) {
//console.log(r);
frappe.msgprint("Email sent");
}
});
});
}
}