Hi
I am trying to avoid users to assign the records they create of a custom module to other users, so what I do is removiing the "Assigned to" field from the EditView. However this is a problem as if the field is not present, the record is not assigned to the creator, (as I do want the owner to appear in the DetailView and ListView).
What I thought was creating a before_save hook to assign the id of the creator to the $bean->Assigned_user_id field of the new record... that is why I have tried to follow your examples... but dont know how to get the user_id of the creator of a record to complete this code... Also just would like this before_save to work at creation time, as if the record is already assigned dont want it to be assigned to every user that can modify the record.
Could you please point me how I can conclude this code to get it working?
Thanks a lot
(This is the before_save hook)
PHP Code:
<?php
/*************************************
This class should assign the record to the user id of the creator
in creation time
*************************************/
class Asignacion {
function AsignacionAutomatica(&$bean, $event, $arguments)
{
if (!($bean->assigned_usr_id == '') && !($bean->assigned_usr_id == null))
{
$bean->assigned_usr_id =
}
}
}
?>
Bookmarks