imbra
April 28, 2023, 7:23am
#1
Good day,
I have a Link field called m_aid, so i want to go to it’s doc type check if the field c_processor is equal to something then i update my current field.
Here is my code
frappe.ui.form.on('Claim', {
setup: function(frm) {
p_instruction: function(frm) {
if (frm.doc.m_aid.c_processor == 'MOD') {
frm.set_value({
p_instruction: 'MIP',
})
}
}
});
use below
frappe.db.get_value("Link Doctype", "doc.link_fieldname_in_current_doctype" ,"value_to_fetch_from_linkfield_doctype_field"
imbra
April 28, 2023, 10:32am
#3
Hey @mohitchechani , thank u, but i have done my code as below and nothing happens.
if (frappe.db.get_value('MACO', 'frm.doc. m_aid', 'c_processor') == "MOD") {
frm.set_value({
payment_instruction: 'MIP',
})
}
use it like this javascript
frappe.db.get_value("User", frappe.session.user, "mobile_no").then(function(r) {
var mobile = r.message.mobile_no;
imbra
April 28, 2023, 11:10am
#5
I want to put it in setup function
setup: function(frm) {
if(frm.doc.p_instruction == ''){
if (frappe.db.get_value('MOD', 'frm.doc.m_aid', 'c_processor') == "MIP") {
frm.set_value({
p_instruction: 'MIP',
})
}
}
},