I made some progress. I used DynamicFieldListGet to figure out I had to
drop "DynamicField_" from the fieldname.
ValueSet still doesn't work.
# get dynamic field config
my $DynamicField = $Self->{DynamicFieldObject}->DynamicFieldGet(
Name => "somename",
);
$Self->{LogObject}->Log(
Priority=>'debug',
Message=> '!!@@Escalation.pm DynamicField ' .
Dumper(\$DynamicField),
);
my $Success = $Self->{BackendObject}->ValueSet(
DynamicFieldConfig => $DynamicField,
ObjectID => $Param{Data}->{TicketID},
Value => [
{
$DestinationSystemTime,
},
],
UserID => $Param{UserID},
);
if ( !$Success ) {
$Self->{LogObject}->Log(
Priority => 'error',
Message =>
"Can not set value for dynamic field $DynamicField->{Name}!"
);
}
debug messages otrs.log:
[Wed Dec 24 15:54:13
2014][Debug][Kernel::System::Ticket::Event::Escalation::Run][233]
!!@@Escalation.pm DynamicField $VAR1 = \{
'FieldType' => 'DateTime',
'ID' => '7',
'ValidID' => '1',
'FieldOrder' => '7',
'InternalField' => '0',
'Label' => 'some label',
'CreateTime' => '2014-12-22 16:17:25',
'Name' => 'somename',
'ChangeTime' => '2014-12-22 16:17:25',
'ObjectType' => 'Ticket',
'Config' => {
'YearsInFuture' => '5',
'YearsInPast' => '5',
'Link' => '',
'DefaultValue' => '0',
'YearsPeriod' => '0'
}
};
[Wed Dec 24 15:54:13
2014][Error][Kernel::System::DynamicField::Backend::ValueSet][512] Could
not update field somename for Ticket ID 5 !
[Wed Dec 24 15:54:13
2014][Error][Kernel::System::Ticket::Event::Escalation::Run][254] Can not
set value for dynamic field somename!
error.log apache:
[Wed Dec 24 15:54:13 2014] -e: Odd number of elements in anonymous hash at
/opt/otrs//Kernel/System/Ticket/Event/Escalation.pm line 243.
ERROR: OTRS-CGI-66 Perl: 5.18.2 OS: linux Time: Wed Dec 24 15:54:13 2014
Message: Could not update field somename for Ticket ID 5 !
RemoteAddress: 192.168.2.1
RequestURI: /otrs/index.pl
Traceback (3992):
Module: Kernel::System::DynamicField::Backend::ValueSet (OTRS 3.3.x git)
Line: 512
Module: Kernel::System::Ticket::Event::Escalation::Run (OTRS 3.3.x git)
Line: 243
Module: Kernel::System::EventHandler::EventHandler (OTRS 3.3.x git)
Line: 255
Module: Kernel::System::Ticket::TicketSLASet (OTRS 3.3.x git) Line: 3008
Module: Kernel::Modules::AgentTicketActionCommon::Run (OTRS 3.3.x git)
Line: 598
Module: Kernel::System::Web::InterfaceAgent::Run (OTRS 3.3.x git) Line:
910
Module:
ModPerl::ROOT::ModPerl::Registry::opt_otrs_bin_cgi_2dbin_index_2epl::handler
(unknown version) Line: 41
Module: (eval) (v1.99) Line: 206
Module: ModPerl::RegistryCooker::run (v1.99) Line: 206
Module: ModPerl::RegistryCooker::default_handler (v1.99) Line: 172
Module: ModPerl::Registry::handler (v1.99) Line: 31
ERROR: OTRS-CGI-66 Perl: 5.18.2 OS: linux Time: Wed Dec 24 15:54:13 2014
Message: Can not set value for dynamic field somename!
RemoteAddress: 192.168.2.1
RequestURI: /otrs/index.pl
Traceback (3992):
Module: Kernel::System::Ticket::Event::Escalation::Run (OTRS 3.3.x git)
Line: 254
Module: Kernel::System::EventHandler::EventHandler (OTRS 3.3.x git)
Line: 255
Module: Kernel::System::Ticket::TicketSLASet (OTRS 3.3.x git) Line: 3008
Module: Kernel::Modules::AgentTicketActionCommon::Run (OTRS 3.3.x git)
Line: 598
Module: Kernel::System::Web::InterfaceAgent::Run (OTRS 3.3.x git) Line:
910
Module:
ModPerl::ROOT::ModPerl::Registry::opt_otrs_bin_cgi_2dbin_index_2epl::handler
(unknown version) Line: 41
Module: (eval) (v1.99) Line: 206
Module: ModPerl::RegistryCooker::run (v1.99) Line: 206
Module: ModPerl::RegistryCooker::default_handler (v1.99) Line: 172
Module: ModPerl::Registry::handler (v1.99) Line: 31
[Wed Dec 24 15:54:13 2014] Escalation.pm: Subroutine new redefined at
/opt/otrs//Kernel/System/Ticket/Event/Escalation.pm line 21.
[Wed Dec 24 15:54:14 2014] Escalation.pm: Subroutine Run redefined at
/opt/otrs//Kernel/System/Ticket/Event/Escalation.pm line 79.
On Wed, Dec 24, 2014 at 3:18 PM, Roald <[email protected]> wrote:
> I get my DynamicFieldObject like this:
> for (qw(ConfigObject DynamicFieldObject TicketObject LogObject
> UserObject CustomerUserObject TimeObject SLAObject))
> {
> $Self->{$_} = $Param{$_} || die "Got no $_!";
> }
>
> But for some reason I can't seem to retrieve the DynamicField and
> corresponding DynamicFieldConfig using DynamicFieldGet.
>
> On Wed, Dec 24, 2014 at 3:16 PM, Roald <[email protected]> wrote:
>
>> relevant debug messages from otrs.log:
>>
>> [Wed Dec 24 15:11:42
>> 2014][Debug][Kernel::System::Ticket::Event::Escalation::Run][225]
>> @@Escalation.pm DynamicField $VAR1 = \{};
>>
>> [Wed Dec 24 15:11:42
>> 2014][Debug][Kernel::System::Ticket::Event::Escalation::Run][230]
>> @@Escalation.pm DynamicFieldConfig $VAR1 = \undef;
>>
>> [Wed Dec 24 15:11:42
>> 2014][Error][Kernel::System::DynamicField::Backend::ValueSet][447] Need
>> DynamicFieldConfig!
>> [Wed Dec 24 15:11:42
>> 2014][Error][Kernel::System::Ticket::Event::Escalation::Run][246] Can not
>> set value for dynamic field!
>>
>>
>> apache2 errorlog :
>>
>> root@otrs:/var/log/apache2# tail -f -n0 error.log
>> [Wed Dec 24 15:11:38 2014] Escalation.pm: Subroutine new redefined at
>> /opt/otrs//Kernel/System/Ticket/Event/Escalation.pm line 21.
>> [Wed Dec 24 15:11:38 2014] Escalation.pm: Subroutine Run redefined at
>> /opt/otrs//Kernel/System/Ticket/Event/Escalation.pm line 79.
>> [Wed Dec 24 15:11:42 2014] -e: Odd number of elements in anonymous hash
>> at /opt/otrs//Kernel/System/Ticket/Event/Escalation.pm line 235.
>> ERROR: OTRS-CGI-66 Perl: 5.18.2 OS: linux Time: Wed Dec 24 15:11:42 2014
>>
>> Message: Need DynamicFieldConfig!
>>
>> RemoteAddress: 192.168.2.1
>> RequestURI: /otrs/index.pl
>>
>> Traceback (3448):
>> Module: Kernel::System::DynamicField::Backend::ValueSet (OTRS 3.3.x
>> git) Line: 447
>> Module: Kernel::System::Ticket::Event::Escalation::Run (OTRS 3.3.x
>> git) Line: 235
>> Module: Kernel::System::EventHandler::EventHandler (OTRS 3.3.x git)
>> Line: 255
>> Module: Kernel::System::Ticket::TicketSLASet (OTRS 3.3.x git) Line:
>> 3008
>> Module: Kernel::Modules::AgentTicketActionCommon::Run (OTRS 3.3.x git)
>> Line: 598
>> Module: Kernel::System::Web::InterfaceAgent::Run (OTRS 3.3.x git)
>> Line: 910
>> Module:
>> ModPerl::ROOT::ModPerl::Registry::opt_otrs_bin_cgi_2dbin_index_2epl::handler
>> (unknown version) Line: 41
>> Module: (eval) (v1.99) Line: 206
>> Module: ModPerl::RegistryCooker::run (v1.99) Line: 206
>> Module: ModPerl::RegistryCooker::default_handler (v1.99) Line: 172
>> Module: ModPerl::Registry::handler (v1.99) Line: 31
>>
>> [Wed Dec 24 15:11:42 2014] -e: Use of uninitialized value in
>> concatenation (.) or string at
>> /opt/otrs//Kernel/System/Ticket/Event/Escalation.pm line 247.
>> ERROR: OTRS-CGI-66 Perl: 5.18.2 OS: linux Time: Wed Dec 24 15:11:42 2014
>>
>> Message: Can not set value for dynamic field!
>>
>> RemoteAddress: 192.168.2.1
>> RequestURI: /otrs/index.pl
>>
>> Traceback (3448):
>> Module: Kernel::System::Ticket::Event::Escalation::Run (OTRS 3.3.x
>> git) Line: 246
>> Module: Kernel::System::EventHandler::EventHandler (OTRS 3.3.x git)
>> Line: 255
>> Module: Kernel::System::Ticket::TicketSLASet (OTRS 3.3.x git) Line:
>> 3008
>> Module: Kernel::Modules::AgentTicketActionCommon::Run (OTRS 3.3.x git)
>> Line: 598
>> Module: Kernel::System::Web::InterfaceAgent::Run (OTRS 3.3.x git)
>> Line: 910
>> Module:
>> ModPerl::ROOT::ModPerl::Registry::opt_otrs_bin_cgi_2dbin_index_2epl::handler
>> (unknown version) Line: 41
>> Module: (eval) (v1.99) Line: 206
>> Module: ModPerl::RegistryCooker::run (v1.99) Line: 206
>> Module: ModPerl::RegistryCooker::default_handler (v1.99) Line: 172
>> Module: ModPerl::Registry::handler (v1.99) Line: 31
>>
>>
>> On Wed, Dec 24, 2014 at 3:00 PM, Roald <[email protected]> wrote:
>>
>>> Dear Martin,
>>>
>>> Thank you!
>>>
>>> I'm currently trying to save new a new value into a Dynamic Field. To do
>>> this I use ValueSet from the BackendObject. ValueSet needs a
>>> DynamicFieldConfig. I'm trying to get this from the DynamicFieldGet method.
>>>
>>> It's not working yet. Any idea why ?
>>>
>>> This is how I created my BackendObject:
>>>
>>> $Self->{BackendObject} = Kernel::System::DynamicField::Backend->new(
>>> EncodeObject => $Param{TicketObject}->{EncodeObject},
>>> MainObject => $Param{TicketObject}->{MainObject},
>>> DBObject => $Param{TicketObject}->{DBObject},
>>> TimeObject => $Param{TicketObject}->{TimeObject},
>>> %Param,
>>> );
>>>
>>> This is how I try to update a Dynamic Field (not working) :
>>>
>>> # get dynamic field config
>>> my $DynamicField = $Self->{DynamicFieldObject}->DynamicFieldGet(
>>> Name => "DynamicField_somename",
>>> );
>>> my $DynamicFieldConfig = $DynamicField->{Config};
>>>
>>> $Self->{LogObject}->Log(
>>> Priority=>'debug',
>>> Message=> 'DynamicField ' . Dumper(\$DynamicField),
>>> );
>>>
>>> $Self->{LogObject}->Log(
>>> Priority=>'debug',
>>> Message=> 'DynamicFieldConfig ' . Dumper(\$DynamicFieldConfig),
>>> );
>>>
>>> my $Success = $Self->{BackendObject}->ValueSet(
>>> DynamicFieldConfig => $DynamicFieldConfig,
>>> ObjectID => $Param{Data}->{TicketID},
>>> Value => [
>>> {
>>> $DestinationSystemTime,
>>> },
>>> ],
>>> UserID => $Param{UserID},
>>> );
>>> if ( !$Success ) {
>>> $Self->{LogObject}->Log(
>>> Priority => 'error',
>>> Message =>
>>> "Can not set value to current time for dynamic
>>> field$DynamicFieldConfig->{Name}!"
>>> );
>>> }
>>>
>>>
>>> # print updated DynamicField_somename
>>> $Self->{LogObject}->Log(
>>> Priority=>'debug',
>>> Message => 'DynamicField_somename ' .
>>> Dumper(\$Ticket{DynamicField_somename}),
>>> );
>>>
>>>
>>>
>>>
>>>
>>> On Tue, Dec 16, 2014 at 2:02 PM, Martin Gruner <[email protected]>
>>> wrote:
>>>
>>>> Hi Roald,
>>>>
>>>> yes this is possible. OTRS also uses a ticket event handler to caclulate
>>>> and store the escalation times for the tickets. This (target) time
>>>> calculation only happens when there are changes to the tickets. The
>>>> escalation notifications etc. are independent of that.
>>>> Of course you can also use a GA job to do this if the delay is ok.
>>>>
>>>> Regards, mg
>>>>
>>>> Am 12.12.14 um 16:43 schrieb Roald:
>>>> > Dear Martijn,
>>>> >
>>>> > Thank you for your reply.
>>>> >
>>>> > I'm currently spending some time at this.
>>>> >
>>>> > It seems to me that a custom ticket event handler can't be used.
>>>> > Suppose I have a field "Time To Intervention" and there needs to be a
>>>> > time based escalation. Is it possible to do time based escalations on
>>>> > dynamic fields using a custom ticket event handler ? I have to do some
>>>> > calculations and look at the calendars.
>>>> >
>>>> > That's why I thought using a generic agent to run every few minutes
>>>> and
>>>> > look at all open tickets should be the way to go. Maybe do it a bit
>>>> > smarter by only looking at open tickets which fullfull some criteria
>>>> > such as not escalating yet.
>>>> >
>>>> > Thanks!,
>>>> >
>>>> > With kind regards,
>>>> > Roald
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> > On Fri, Nov 28, 2014 at 1:00 PM, <[email protected]
>>>> > <mailto:[email protected]>> wrote:
>>>> >
>>>> > Send dev mailing list submissions to
>>>> > [email protected] <mailto:[email protected]>
>>>> >
>>>> > To subscribe or unsubscribe via the World Wide Web, visit
>>>> > http://lists.otrs.org/cgi-bin/listinfo/dev
>>>> > or, via email, send a message with subject or body 'help' to
>>>> > [email protected] <mailto:[email protected]>
>>>> >
>>>> > You can reach the person managing the list at
>>>> > [email protected] <mailto:[email protected]>
>>>> >
>>>> > When replying, please edit your Subject line so it is more
>>>> specific
>>>> > than "Re: Contents of dev digest..."
>>>> >
>>>> >
>>>> > Today's Topics:
>>>> >
>>>> > 1. Re: developing custom SLA/Service escalations and
>>>> > notifications (Martin Gruner)
>>>> > 2. OTRS 5 development (Martin Gruner)
>>>> >
>>>> >
>>>> >
>>>> ----------------------------------------------------------------------
>>>> >
>>>> > Message: 1
>>>> > Date: Thu, 27 Nov 2014 13:24:24 +0100
>>>> > From: Martin Gruner <[email protected]
>>>> > <mailto:[email protected]>>
>>>> > Subject: Re: [dev] developing custom SLA/Service escalations and
>>>> > notifications
>>>> > To: Development community of OTRS <[email protected] <mailto:
>>>> [email protected]>>
>>>> > Message-ID: <[email protected]
>>>> > <mailto:[email protected]>>
>>>> > Content-Type: text/plain; charset=windows-1252
>>>> >
>>>> > Hello Roald,
>>>> >
>>>> > Am 26.11.14 um 17:29 schrieb Roald:
>>>> > > Hi,
>>>> > >
>>>> > > I'm new to OTRS development.
>>>> > >
>>>> > > Requirements in a nutshell:
>>>> > > * set custom fields for SLA's
>>>> > > * calculate whether a ticket escalates based on these custom
>>>> fields (do
>>>> > > some custom calculations)
>>>> > > * send notifications to agents based on these escalations
>>>> > > * there are also other requirements but most can be solved
>>>> without
>>>> > > development
>>>> > >
>>>> > > Idea on how to approach this:
>>>> > > * xml file in /opt/otrs/Kernel/Config/Files which uses
>>>> SLAPreferences
>>>> > >
>>>> > > <?xml version="1.0" encoding="utf-8" ?>
>>>> > > <otrs_config version="1.0" init="Framework">
>>>> > > <ConfigItem Name="SLAPreferences###010-TTI" Required="0"
>>>> Valid="1">
>>>> > > <Description Translatable="1">Time To
>>>> Intervention.</Description>
>>>> > > <Group>Ticket</Group>
>>>> > > <SubGroup>Frontend::SLA::Preferences</SubGroup>
>>>> > > <Setting>
>>>> > > <Hash>
>>>> > > <Item
>>>> > > Key="Module">Kernel::Output::HTML::SLAPreferencesGeneric</Item>
>>>> > > <Item Key="Label">label for dynamic field</Item>
>>>> > > <Item Key="Desc">description.</Item>
>>>> > > <Item Key="Block">Input</Item>
>>>> > > <Item Key="PrefKey">dynamicfield</Item>
>>>> > > </Hash>
>>>> > > </Setting>
>>>> > > </ConfigItem>
>>>> > > ........
>>>> > > </otrs_config>
>>>> > >
>>>> > > * write a custom module with a job that should be run by
>>>> Generic Agent
>>>> > > to do the rest. Maybe split it in two modules.
>>>> > >
>>>> > > Questions:
>>>> > > * Is my approach the most straightforward and suitable one ?
>>>> >
>>>> > Sounds pretty straightforward. I think you might not need a GA
>>>> job, but
>>>> > could do with a custom ticket event handler like
>>>> > Kernel::System::Ticket::Event::TicketEscalationIndex instead.
>>>> >
>>>> > > * How do I calculate using the calendars ? For example hours
>>>> outside
>>>> > > business hours don't count for one specific calendar. While
>>>> there is
>>>> > > also a 24/7 calendar.
>>>> >
>>>> > I'd recommend to tailor the calendars just as you need. For 24/7
>>>> you can
>>>> > have a calendar that has everything marked, for the other one just
>>>> > define all non-business hours as business hours.
>>>> >
>>>> > Regarding the question from your other mail: with the custom event
>>>> > handler you can also set a dynamic field.
>>>> >
>>>> > Good luck!
>>>> >
>>>> > Best regards, mg
>>>> >
>>>> > --
>>>> > Martin Gruner
>>>> > Senior Developer R&D
>>>> >
>>>> > OTRS AG
>>>> > Bahnhofplatz 1a
>>>> > 94315 Straubing
>>>> >
>>>> > T: +49 (0)6172 681988 0
>>>> > F: +49 (0)9421 56818 18
>>>> > I: www.otrs.com/ <http://www.otrs.com/>
>>>> >
>>>> > Gesch?ftssitz: Bad Homburg, Amtsgericht: Bad Homburg, HRB 10751,
>>>> > USt-Nr.: DE256610065
>>>> > Aufsichtsratsvorsitzender: Burchard Steinbild, Vorstand: Andr?
>>>> > Mindermann (Vorsitzender), Christopher Kuhn, Sabine Riedel
>>>> >
>>>> > Schlanker, schneller und flacher denn je - OTRS 4! Und f?r alle,
>>>> die
>>>> > MEHR wollen: Entdecken Sie hier die OTRS Business Solution? mit
>>>> mehr
>>>> > Business Features!
>>>> >
>>>> https://www.otrs.com/otrs-business-solution-fuer-besseren-kundenservice/?lang=de
>>>> >
>>>> >
>>>> > ------------------------------
>>>> >
>>>> > Message: 2
>>>> > Date: Thu, 27 Nov 2014 15:03:27 +0100
>>>> > From: Martin Gruner <[email protected]
>>>> > <mailto:[email protected]>>
>>>> > Subject: [dev] OTRS 5 development
>>>> > To: Development community of OTRS <[email protected] <mailto:
>>>> [email protected]>>
>>>> > Message-ID: <[email protected]
>>>> > <mailto:[email protected]>>
>>>> > Content-Type: text/plain; charset=utf-8
>>>> >
>>>> > Dear OTRS developers,
>>>> >
>>>> > as you might have heard, OTRS 4 is now released and development
>>>> for OTRS
>>>> > 5 will start soon.
>>>> >
>>>> > Do you plan to make substantial contributions to it? If that is
>>>> the
>>>> > case, I want to offer you to plan and coordinate this together,
>>>> to make
>>>> > sure right from the planning period that your contributions can
>>>> find
>>>> > their way into OTRS 5.
>>>> >
>>>> > Please just let me know via reply on this list.
>>>> >
>>>> > Thanks and best regards, Martin
>>>> >
>>>> > --
>>>> > Martin Gruner
>>>> > Senior Developer R&D
>>>> >
>>>> > OTRS AG
>>>> > Bahnhofplatz 1a
>>>> > 94315 Straubing
>>>> >
>>>> > T: +49 (0)6172 681988 0 <tel:%2B49%20%280%296172%20681988%200>
>>>> > F: +49 (0)9421 56818 18 <tel:%2B49%20%280%299421%2056818%2018>
>>>> > I: www.otrs.com/ <http://www.otrs.com/>
>>>> >
>>>> > Gesch?ftssitz: Bad Homburg, Amtsgericht: Bad Homburg, HRB 10751,
>>>> > USt-Nr.: DE256610065
>>>> > Aufsichtsratsvorsitzender: Burchard Steinbild, Vorstand: Andr?
>>>> > Mindermann (Vorsitzender), Christopher Kuhn, Sabine Riedel
>>>> >
>>>> > Schlanker, schneller und flacher denn je - OTRS 4! Und f?r alle,
>>>> die
>>>> > MEHR wollen: Entdecken Sie hier die OTRS Business Solution? mit
>>>> mehr
>>>> > Business Features!
>>>> >
>>>> https://www.otrs.com/otrs-business-solution-fuer-besseren-kundenservice/?lang=de
>>>> >
>>>> >
>>>> > ------------------------------
>>>> >
>>>> > _______________________________________________
>>>> > dev mailing list
>>>> > [email protected] <mailto:[email protected]>
>>>> > http://lists.otrs.org/cgi-bin/listinfo/dev
>>>> >
>>>> >
>>>> > End of dev Digest, Vol 44, Issue 6
>>>> > **********************************
>>>> >
>>>> >
>>>> >
>>>> > _______________________________________________
>>>> > OTRS mailing list: dev - Webpage: http://otrs.org/
>>>> > Archive: http://lists.otrs.org/pipermail/dev
>>>> > To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/dev
>>>> >
>>>>
>>>> --
>>>> Martin Gruner
>>>> Senior Developer R&D
>>>>
>>>> OTRS AG
>>>> Bahnhofplatz 1a
>>>> 94315 Straubing
>>>>
>>>> T: +49 (0)6172 681988 0
>>>> F: +49 (0)9421 56818 18
>>>> I: www.otrs.com/
>>>>
>>>> Geschäftssitz: Bad Homburg, Amtsgericht: Bad Homburg, HRB 10751,
>>>> USt-Nr.: DE256610065
>>>> Aufsichtsratsvorsitzender: Burchard Steinbild, Vorstand: André
>>>> Mindermann (Vorsitzender), Christopher Kuhn, Sabine Riedel
>>>>
>>>> Schlanker, schneller und flacher denn je - OTRS 4! Und für alle, die
>>>> MEHR wollen: Entdecken Sie hier die OTRS Business Solution™ mit mehr
>>>> Business Features!
>>>>
>>>> https://www.otrs.com/otrs-business-solution-fuer-besseren-kundenservice/?lang=de
>>>> _______________________________________________
>>>> OTRS mailing list: dev - Webpage: http://otrs.org/
>>>> Archive: http://lists.otrs.org/pipermail/dev
>>>> To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/dev
>>>>
>>>
>>>
>>
>
_______________________________________________
OTRS mailing list: dev - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/dev
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/dev