here when i link an employee to service assigned to that employe should get the permission to access the document
How can i set that
Is that possible to automatically send to a employee who i set in the ‘Service Assigned To’ field @bahaou
def on_submit(self):
# Assuming `self` is an instance of a document
if self.custom_service_assigned_to:
# Iterate over each employee listed in custom_service_assigned_to
for employee in self.custom_service_assigned_to:
# Share the document with the employee
frappe.share.add_docshare(
self.doctype,
self.name,
employee,
write=1,
submit=1,
share=1,
flags={"ignore_share_permission": True}
)
@amal_31845 almost there , you need to get the user_id from the employee and use it instead of the employee
1 Like