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.
When you click “Assign,” a dialog opens up, but there’s no option to set conditions or read/write options. so you can’t configure this using client scripts.
Hi @Nirvisha_Soni, It was resolved.
Previously I didn’t give user role properly so for the assigned user, task became read only, Now I gave project user role so, everything works fine
Thanks
BTW, I have one doubt. While creating task from server script using get_doc, Can I assign user? I’ve tried but it isn’t working tho