Set _assign field using script

My use case is to assign a form to a user. I was thinking to use _assign field and tried the following

 frappe.db.sql( """UPDATE `tabLead Fetch` SET _assign= %s, validation_user=%s 
                WHERE name=%s""", ( user_id_formatted_string, user_id,
                form_dict['lead_id'], )
 ) 

I checked the database and the _assign was correctly updated but I couldn’t see the change reflecting in UI. Can anyone tell me the proper way of assigning it using the API itself ?

Create ToDo against user.
Check following code. It will assign form to User.

1 Like

Thanks, I’ll try that