Change user when isn't administrator

Hey,

I’m not sure if there are options for control at that level, out of the box

However, it sounds like something that’d be possible with custom changes.

I suppose it depends on how much administrator-level verification you’d like.

For example, the following Logic Hook would prevent non-admin users from changing the “Assigned User” value.
(Both on Edit and Create views)

class keepAssigneeC{
    public function keepAssigneeF(SugarBean $bean, $event, $arguments){
        global $current_user;       

        $user = BeanFactory::getBean('Users', $current_user->id);

//If user is not an Admin, and a new record is being created
        if (!($user->is_admin) && $bean->fetched_row["id"]==""){            
 //Keep the Assigned user as Current user
            $bean->assigned_user_id = $current_user->id;
        }         
// Else, if User is not Admin, and an existing record is being edited
        elseif (!($user->is_admin) && $bean->fetched_row["assigned_user_id"]!=$bean->assigned_user_id)
       {
 //Set the assigned user back to previous value.
           $bean->assigned_user_id = $bean->fetched_row["assigned_user_id"];
       }
    }
}

I’ve written some posts recently on setting up Logic Hooks, such as:

But let me know if you have any questions :slight_smile:


Or, are you looking for something more advanced?
What sort of flow are you imagining?