Currently I'm trying to change the 'Assigned To' user for a lead to the current user whenever a user enters the lead details screen.
I have the following code:
function checkPermission(Vtiger_Request $request) {
$moduleName = $request->getModule();
$recordId = $request->get('record');
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
$recordModel->set('assigned_user_id',$current_user->id);
$recordModel->save();
...
return true;
}
The problem is, instead of saving the current record with a new assigned user, vTiger duplicates this record into a new record and saves it with the current user as a new assigned user.
Working on vTiger v6.2.0