Yes, I know how to do it manually. But then what’s the point of link field if it’s just one time relationship ? I want the value to be reflected automatically when the change is made in one table. This just defeats the whole purpose of having an external relationship with another doctype.
Yes this can be done with client side, except the code is kind of ugly.
//Code to update linked field + fields which fetch from linked field
// Does this by comparing modified timestamps
function auto_update_batch_link()
{
var parent_doc;
var temp_doc;
parent_doc = frappe.db.get_doc("Doctype Name", cur_frm.doc.LinkedField)
parent_doc.then((temp_doc) =>
{if (temp_doc.modified >= cur_frm.doc.modified)
{
//To reload fields that fetch from a linked field to have to toggle it
//In this code resets the linked field, which will update the fetch fields
var original_link = cur_frm.doc.LinkedField
cur_frm.set_value('LinkedField',"")
cur_frm.refresh_field('LinkedField')
cur_frm.set_value('LinkedField',original_link)
cur_frm.refresh_field('LinkedField')
cur_frm.save() //Optional don't have to auto-save
console.log('Auto-Updated Linked Field')
}
}
)
}