Push field changes into communication database

Hi,

I have managed to do a “workflow” where an owner is unable to change certain field in custom script.

var test = frappe.user_info().email
cur_frm.set_value(“current_user”,test);

frappe.ui.form.on(“Sales Order”, “validate”, function(frm){
if(cur_frm.doc.owner==test){
cur_frm.set_value(“workflow_state”,“Pending For Approval”)}
else if(frm.doc.peer_approval==“Reject”){
cur_frm.set_value(“workflow_state”,“Rejected”)}
else if(frm.doc.peer_approval==“Approve”){
cur_frm.set_value(“workflow_state”,“Approved”)}
});

The problem using this method is that the document history (which I believe is in communication table) is not captured.

Can anyone guide me on how to push the “workflow state” changes into communication database?

Thanks!

This will automatically be captured in 7.3 with built-in versioning

1 Like

Hi!

Yeah, many thanks! That is great but current client have many customizations so we don’t plan to upgrade to 7.3 for them.

I saw your solution here - Set comment on another document?
but this is to add comment. Will try and see how it goes if suits me fine.

May be this will help

1 Like

Hi @Hafees_Kazhunkil,

Yes the code works! Thanks!