good day all,
I am trying a script to automatically set the value of a field on a form. The value is fetched from a linked field
The script work fine if I put it on the console of my browser.
refresh: function(frm) {
frm.disable_save();
if (cur_frm.doc.course) {
frappe.call({
'method': 'frappe.client.get',
args: {
doctype: 'Course',
name: cur_frm.doc.course
},
callback: function(data) {
cur_frm.set_value('calendar_event_color', data.message.calendar_event_color);
}
});
}
Now, I just changed the cur_frm with frm (because frm doesn’t work in the browser console) and the script doesn’t work at all. There is no error message, but the value is not set in the field.
So writing this in my .js file and nothing happen?
refresh: function(frm) {
frm.disable_save();
if (frm.doc.course) {
frappe.call({
'method': 'frappe.client.get',
args: {
doctype: 'Course',
name: frm.doc.course
},
callback: function(data) {
frm.set_value('calendar_event_color', data.message.calendar_event_color);
}
});
}
What am I missing or doing wrong?
Thanks for any help you could give.