[Vtigercrm-developers] vtiger custom event handler and workflows: $current_user
Alan Lord
alanslists at gmail.com
Mon Jun 3 08:43:06 GMT 2019
Just FYI - with the #899 patch I can do what I need with an Event
Handler, but not with a custom Workflow function.
$current_user in the custom Workflow function always seems to be admin.
Al
On 31/05/2019 12:44, Alan Lord wrote:
> Ignore this particular issue.
>
> For some reason the system I was developing on didn't have the patch
> from #899 in it :-(
>
> http://code.vtiger.com/vtiger/vtigercrm/issues/899
>
> Sorry for the noise.
>
> Al
>
> On 31/05/2019 12:22, Alan Lord wrote:
>> 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
>>
More information about the vtigercrm-developers
mailing list