Dynamic fileds update cannot be displayed on webui

Moderator: crythias

Locked
silkgoat
Znuny newbie
Posts: 11
Joined: 29 Nov 2011, 16:26
Znuny Version: 2.4, 3.0.11

Dynamic fileds update cannot be displayed on webui

Post by silkgoat »

Hi,

I extended our otrs system using dynamic fileds. I created a drop-down filed with to values: waiting_for_customer, waiting_for agent.
I created the two modules to change these fields on the webUI.

In our old OTRS (3.0.1 I used freetextfields) it worked. After I updated our OTRS (3.2.10) and rewrite the modules using dynamic fields it does not.
One module is for displaying a menu button 'ChangeWait' and the other is for 'togle' the state.
Kernel/Output/HTML/TicketMenuWait.pm (it displays the button and sends http://blahblahblah/?Action=AgentTicket ... ate=<agent or customer>)
Kernel/Modules/AgentTicketWait.pm (it updates the database with the new value)

When I click on the button, it changes the value_text in dynamic_field_value table but the change isn't displayed on the webUI.
I tried to add a note and change the dynamic filed. The database wasn't changed (the value remaind the same (i set ut up with changewait earlier) in dynamic_field_value table), but it displayed correctly on the webUI.

Did I miss something?
Can you help me?

Here are the modules:
http://pastebin.com/SBUE6LWH
http://pastebin.com/YEXq70vj
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Dynamic fileds update cannot be displayed on webui

Post by reneeb »

You have to clear the cache for the updated ticket. See the various methods of Kernel/System/Ticket.pm for sample code...
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
silkgoat
Znuny newbie
Posts: 11
Joined: 29 Nov 2011, 16:26
Znuny Version: 2.4, 3.0.11

Re: Dynamic fileds update cannot be displayed on webui

Post by silkgoat »

Hi,

Thank you reneeb. If I use bin/otrs.DeleteCache.pl it works.
I trid to find how to delete the updated item from the cache, but as I see I need a cachekey value.
I found the changes (when I reloaded the page after delectecache) in a cachefile under the var/tmp/CacheFileStorable/CacheInternalTicket/ folder. But how can i get the key?

I added this line to both of the modules, but it didn't solve the problem:

Code: Select all

$Self->{TicketObject}->_TicketCacheClear( TicketID => $Param{Ticket}->{TicketID} );
Can you help?

Regards,
Robert
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Dynamic fileds update cannot be displayed on webui

Post by crythias »

Don't manipulate the database table. Use the API.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
silkgoat
Znuny newbie
Posts: 11
Joined: 29 Nov 2011, 16:26
Znuny Version: 2.4, 3.0.11

Re: Dynamic fileds update cannot be displayed on webui

Post by silkgoat »

Hi crythias,

I tried to find a function which ccan be used for this update but I couldn't find any using this site: http://dev.otrs.org/cvs/.

Can you help me how can I update a dynamic value using the ticketid and the dynamicfiled name?

Regards,
Robert
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Dynamic fileds update cannot be displayed on webui

Post by crythias »

For each file in Kernel/System
perldoc file.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
silkgoat
Znuny newbie
Posts: 11
Joined: 29 Nov 2011, 16:26
Znuny Version: 2.4, 3.0.11

Re: Dynamic fileds update cannot be displayed on webui

Post by silkgoat »

Hi,

So i found something. Just tell me if I'm on the right way. :D

in Kernel::System::DynamicField::Backend

Code: Select all

my $Success = $BackendObject->ValueSet(
                   DynamicFieldConfig => $DynamicFieldConfig,      # complete config of the DynamicField
                   ObjectID           => $ObjectID,                # ID of the current object that the field
                                                                   # must be linked to, e. g. TicketID
                   Value              => $Value,                   # Value to store, depends on backend type
                   UserID             => 123,
               );
Regards,
Robert
silkgoat
Znuny newbie
Posts: 11
Joined: 29 Nov 2011, 16:26
Znuny Version: 2.4, 3.0.11

[SOLVED] Dynamic fileds update cannot be displayed on webui

Post by silkgoat »

Hi,

Ok, $BackendObject->ValueSet was the key.

Thank You all!

Regards,
Robert
Locked