I created a custom field button in a Maintenance Visit Purpose table and I’m trying run something when I click it.
Tried:
frappe.ui.form.on("Maintenance Visit Purpose", "orcamento", function(frm){
cur_frm.cscript.orcamento = function(){console.log("works!");
})
frappe.ui.form.on("Maintenance Visit Purpose", "orcamento", function(frm){
console.log("works!");
})
froldan
3
Try with:
frappe.ui.form.on("Maintenance Visit Purpose", "orcamento", function(frm){
cur_frm.cscript["orcamento"] = function(doc, dt, name){
alert('works')
}
});
froldan
5
It’s the form, doesn’t matter the name you assign to the variable.
I have edit my answer.
That’s worked!
Thank you very much @froldan
froldan
7
You’re welcome
I realized that my answer is the same that your first approach, you just have a syntax error, missing “}” after console.log(“works!”).