[Vtigercrm-developers] vtiger custom event handler and workflows: $current_user

Alan Lord alanslists at gmail.com
Fri May 31 11:22:48 GMT 2019


I raised a ticket [1] loosely related to this subject not so long ago 
but it seems the issue is more widespread... A quick search of google 
shows quite a few people coming up against the same problems...


I wanted to write a Custom Workflow function that would populate a field 
with the $current_user's user_name when they changed a certain field to 
something else.

Using a Workflow function proved unworkable because by the time the 
workflow function was triggered the $current_user is set to "admin".

So I thought I'd try and event Handler instead and use the VTEntityDelta 
to determine if the right field had been changed...

Unfortunately, vtiger.event.aftersave, and vtiger.event.aftersave.final 
both exhibit the same problem - the global var $current_user is always 
"admin" irrespective of which user actually triggered the event.

vtiger_even.beforesave and beforesave.final do have the correct 
$current_user, but they do not have a delta.

 From my searches online these changes seem to have happened with a 
fairly recent update but I am not clear where or when this happened.

But irrespective - this is extremely annoying and has wasted a lot of my 
time.

[1] http://code.vtiger.com/vtiger/vtigercrm/issues/1125

Please vtiger - can you fix this? It is a mess. Customers are getting 
their modTracker data populated with "admin" when it shouldn't be, and 
now it seems we can't use Event Handlers properly either...



More information about the vtigercrm-developers mailing list