i want to assign new user to issue document based on some condition , and i want this user to appear on form sidebar under assigned to.
frappe.ui.form.on(‘Issue’, {
refresh: function(frm) {
frappe.db.get_value(‘Issue’, frm.doc.name,‘_assign’, function(value) {
if (value._assign.includes(‘user2’)){
let assignArray = JSON.parse(value[“_assign”]);
assignArray.push(“user3”);
console.log(“assignArray” + assignArray);
let newAssignString = JSON.stringify(assignArray);
value[“_assign”] = newAssignString;
} else {
console.log(“Not OK”);
}
});
}
});
the result is [“user1”,“user2”,“user3”]
but user3 did not appear on
It works,sets the user in assigned_to field but does not add, so the dialog box is still open, and have to manually click on add. Also, it shows fields have missing values: Assign To.