Generic agent overwrites DynamicFields

Moderator: crythias

Post Reply
hkais
Znuny expert
Posts: 280
Joined: 16 Apr 2016, 08:55
Znuny Version: see in post
Real Name: Hans
Contact:

Generic agent overwrites DynamicFields

Post by hkais »

We are developing a extension for GA

and we are wondering about the fact, that defining a GA with a

Execute custom module

Module: (nothing set)
Param 1 key: DynamicField_aDynamicField
Param 1 value: a value

the value will be hard inserted into the DynamicField_aDynamicField

why is this behaviour? It is looking odd to me?

1. the module is unset, so there is nothing to be called, and the dynamic field is getting set
2. even if a module is set, the dynamic field is getting set


Is this behaviour intentionally implemented this way?
Last edited by hkais on 14 Aug 2022, 21:51, edited 1 time in total.
Elected 2022-06 as an IT Governance Portal Expert. The portal for Znuny, OTRS and OTOBO users
Johannes
Moderator
Posts: 391
Joined: 30 Jan 2008, 02:26
Znuny Version: All of them ^^
Real Name: Hannes
Company: Znuny|OTTERHUB

Re: Generic agent overwrites DynamicFields

Post by Johannes »

Hi,

if I understand you correct you have created a new job, wiggle around things and in the section "Execute custom module"
you don't set a module but just fill key and value with the dynamic field values.

Correct?
If so the parameters are added to the current job. Because you did not specify a module to execute them with, the parameters are simply added to the current job. It would also overwrite existing entries, defined earlier.

The reason for this is: if you specify a module, the module handle the updates passed to it.
In your module you may want the one from the GUI and the custom keys.
If you don't specify a custom module then the "Generic" module handles everything.
The config hash is the same.

Regards
Johannes
hkais
Znuny expert
Posts: 280
Joined: 16 Apr 2016, 08:55
Znuny Version: see in post
Real Name: Hans
Contact:

Re: Generic agent overwrites DynamicFields

Post by hkais »

Johannes wrote: 15 Aug 2022, 11:11 Hi,

if I understand you correct you have created a new job, wiggle around things and in the section "Execute custom module"
you don't set a module but just fill key and value with the dynamic field values.

Correct?
yes, the dynamic field with DynamicField_ is set as key and a value to the value field

Johannes wrote: 15 Aug 2022, 11:11 If so the parameters are added to the current job. Because you did not specify a module to execute them with, the parameters are simply added to the current job. It would also overwrite existing entries, defined earlier.

The reason for this is: if you specify a module, the module handle the updates passed to it.
In your module you may want the one from the GUI and the custom keys.
If you don't specify a custom module then the "Generic" module handles everything.
The config hash is the same.
the issue has two cases:

- setting only a DynamicField_ without a module
=> the dynamic field is set with the given value

- setting a module and passing DynamicField_ as a parameter to the module
AND
the module does not require to modify the DynamicField_ (due to the use case)
=> the dynamic field is overwritten with the given value from the parameter value

the later behaviour is really strange
Elected 2022-06 as an IT Governance Portal Expert. The portal for Znuny, OTRS and OTOBO users
Johannes
Moderator
Posts: 391
Joined: 30 Jan 2008, 02:26
Znuny Version: All of them ^^
Real Name: Hannes
Company: Znuny|OTTERHUB

Re: Generic agent overwrites DynamicFields

Post by Johannes »

Johannes wrote: 15 Aug 2022, 11:11 - setting a module and passing DynamicField_ as a parameter to the module
AND
the module does not require to modify the DynamicField_ (due to the use case)
=> the dynamic field is overwritten with the given value from the parameter value

the later behaviour is really strange
I don't understand this part. The df value is set, a module is set and it is modified.
This is the same. The module is only executed as an "additional" element. If you don't need it, leave it blank.

The reason for this is you can combine multiple changes GUI+Module.
hkais
Znuny expert
Posts: 280
Joined: 16 Apr 2016, 08:55
Znuny Version: see in post
Real Name: Hans
Contact:

Re: Generic agent overwrites DynamicFields

Post by hkais »

Johannes wrote: 16 Aug 2022, 12:05 I don't understand this part. The df value is set, a module is set and it is modified.
This is the same. The module is only executed as an "additional" element. If you don't need it, leave it blank.

The reason for this is you can combine multiple changes GUI+Module.
the module does not require to change the dynamic field. Means the dynamic field is untouched in terms of a setter function.

what would be the proper behaviour from configuration perspective, in the case
- we have a module, which modifies the dynamic field in some specific use cases
- but it also does not need to modify the dynamic field in some use cases
Elected 2022-06 as an IT Governance Portal Expert. The portal for Znuny, OTRS and OTOBO users
Johannes
Moderator
Posts: 391
Joined: 30 Jan 2008, 02:26
Znuny Version: All of them ^^
Real Name: Hannes
Company: Znuny|OTTERHUB

Re: Generic agent overwrites DynamicFields

Post by Johannes »

Without any code/use case it is just a guess, but I would not rely on the params in this way. Why not let the module decide. We usually don’t use the params at all, just call the module and handle the rest there. We (rarely) use a combination at all.
The other solution, probably to simple for the case, is to use two Jobs for this.

Regards
Post Reply