12-06-2016, 07:58 AM
I have this workflow custom function in place:
But not able to test it, would the getting of the current user ID work by getting it from the session?
PHP Code:
function updateInvoiceAssignedTo($entity) {
global $adb,$default_charset,$log,$current_user;
list($invoice,$invoice_crm_id) = explode('x',$entity->data['id']); // separate webservice ID
if (getSalesEntityType($invoice_crm_id)=='Invoice') {
// Get the current user from the session
$user = new Users();
$user->retrieveCurrentUserInfoFromFile($_SESSION['authenticated_user_id']);
// list($usr,$usr_id) = explode('x', $entity->data['assigned_user_id']);
$query = 'UPDATE vtiger_crmentity SET smownerid=? WHERE crmid=?';
$params = array($user->id, $invoice_crm_id);
$adb->pquery($query, $params);
}
}
But not able to test it, would the getting of the current user ID work by getting it from the session?