How i can access first assigne of a doctype in a field

How the first assignee ( based on assignment rules) can be accessed in a field after the insert of the record. Thanks in advance

@CA_B.C_Chechani on trigger of assignment rules last user field gets updated so you can update it in your record

If there is a single assignee (user) so how we can get it values of assign to after inserting of document and the assignment rule triggered. Our need to fill another custom field based on the assign_to value

Can you brief your requirement? What needs to be executed

ERPNEXT assign a record to a user through automatic assignment so I want to access that value to be filled in custom filed and few depends on values based this custom filed value that is equal to user to whom record was assigned

you can access that value from db column name “_assign” for each assignment this field gets updated.

Thanks, I understand it, what is this filed “_assign” type so I can try to retrieve it. Also, request if you have the exact idea then hint for possible server script

assignee = frappe.db.get_value(doctype, docype_no, “_assign”)
custom field = assignee.
try this on after_insert.

_assign - when a user is assigned to a record this field gets updated in the DB.

1 Like

Thanks, I can get assigned user as guided by you by the following function but , I can not get values of _assign at after insert event , so whether _assgin values are accessible at after insert? please guide

def get_assignee_user_id(name):
    assignee = frappe.db.get_value( "Knee Lead", name, "_assign")
    return assignee_name
1 Like

I could get the assigned user id from to-do doctype and allocated_to field as it is equal to assignee and written after-insert script on to-do