I need to change the displayed value of a link field and I assumed that using frappe.form.link_formatters would solve the problem
I added this to the js file for my doctype
frappe.ui.form.on('MyDoctype', {
onload: function (frm) {
console.log("onload formatter test");
frappe.form.link_formatters['My Doctype I want to Display'] = function(value, doc) {
console.log("onload formatter for my doctype value=" + value + " doc.name=" + doc.name);
return value + ":" + doc.name;
}
}
In the debugger window on my browser I see the console print my messages so the function is definitely being called but my link field never changes.
Looking through these forums I find these 2 threads
This one talks about how it only works with read-only fields
Here some one posted a bug report a year ago describing exactly what I am experiencing.
Is this supposed to work.
I am using
erpnext 10.1.64
frappe 10.1.56
Bump.
Is there anyone who has tried this and gotten it to work. A simple “yes it worked for me” would lead me to look for what I am doing wrong. It is just that the supplied examples are clear and my code seems to be functioning but there is no apparent effect in the U.I.
Before I spend time writing my own method I would like to be sure that I am not duplicating something that works.
What I need is for the displayed text in the link field to show something that has business meaning and not be confined to showing something which has database meaning.
It is very confusing for users to see something like 96aefd when what they really need to see is a name that has meaning to them.
You can utilize view settings to elegantly present the ID alongside the name. This approach ensures a seamless display of information, enhancing user experience within your Frappe application
example: