Event not triggered while setting dynamic field value via API call
Event not triggered while setting dynamic field value via API call
I'm currently creating an event module which reacts to the setting of the ITSM due date field. It works fine if I set it through the interface in the "Additional ITSM fields" dialog. But when I set the value via code, it seems the event is not triggered. Do I have to trigger the event separately or something?
-
- Znuny guru
- Posts: 2210
- Joined: 13 Mar 2014, 09:16
- Znuny Version: 6.0.14
- Real Name: Rolf Straub
Re: Event not triggered while setting dynamic field value via API call
Hey there,
I took a look into the Ticket.pm, for example if you update a title. This function also triggers an event:
So how exactly are you updating your value via code? You might want to look into the perl file that handles the updates, or simply add an event to your code.
I took a look into the Ticket.pm, for example if you update a title. This function also triggers an event:
Code: Select all
$Self->EventHandler(
Event => 'TicketTitleUpdate',
Data => {
TicketID => $Param{TicketID},
},
UserID => $Param{UserID},
);
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
Re: Event not triggered while setting dynamic field value via API call
Code: Select all
my $Success = $Self->{DynamicFieldValueObject}->ValueSet(
FieldID => 10,
ObjectID => $Param{Data}->{TicketID},
Value => [
{
ValueDateTime => $timestamp,
},
],
UserID => 1,
);
-
- Znuny guru
- Posts: 2210
- Joined: 13 Mar 2014, 09:16
- Znuny Version: 6.0.14
- Real Name: Rolf Straub
Re: Event not triggered while setting dynamic field value via API call
If you look into the code:
https://github.com/OTRS/otrs/blob/rel-4 ... lue.pm#L82
There is nothing about raising an event. You might have to raise an event via the EventHandler.
Try naming your event "TicketDynamicFieldUpdate_NameOfYourField".
https://github.com/OTRS/otrs/blob/rel-4 ... lue.pm#L82
There is nothing about raising an event. You might have to raise an event via the EventHandler.
Try naming your event "TicketDynamicFieldUpdate_NameOfYourField".
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
Re: Event not triggered while setting dynamic field value via API call
Fantastic! Thanks! Have a great day!