How to assign a doctype to a user through server side script

I want to assign a doctype to a user through server side script, how can i do it?

Hi @Vinay1:

Actually, assignments are “related” ToDo’s.

Let’s say you want to assign a Sales Order.

Try something like this on your server script:

new_assign = frappe.get.doc(
    {"doctype": "ToDo",
    "allocated_to": your_desired_user,
    "reference_type": "Sales Order",
    "reference_name": doc.name,
    "description": "There is a new sales order for you ...",
    "priority": "Medium",
    "date": your_date,
    "assigned_by": frappe.session.user
}).insert(ignore_permissions=True)

Hope this helps.

1 Like

hi @avc,
i am talking about this one

above code is related this this one only right?

yes the above code is for that one

but from the code to do was craeted but not display in this