RT::Extension::MandatoryOnTransition 0.19 - Different conditions for the same CustomField - Syntax incorrect?

Hello everybody,

I am not able to check different values for different conditions for one and the same custom field.

Goal:
On status changes from * to resolved, the CF.GEE must have a value and the value must be ‘erteilt’
On status changes from * to rejected, the CF.GEE must have a value and the value must be ‘verweigert’
Queue: 'PK GEE Acquisition

My config:
Set(%MandatoryOnTransition,
‘PK GEE Akquise’ => {
‘* -> resolved’ => [ ‘CF.GEE’ ],
‘CF.GEE’ => { transition => ‘* -> resolved’, must_be => [‘erteilt’] },
‘* -> rejected’ => [ ‘CF.GEE’ ],
‘CF.GEE’ => { transition => ‘* -> rejected’, must_be => [‘verweigert’] },
},
);

CF.GEE has the Typ ‘Select one value’

Result:
Message when resolving the ticket: GEE is required when changing status to resolved
Message when rejecting the ticket: GEE must be denied when changing status to rejected
==> ‘CF.GEE’ => { transition => ‘* -> resolved’, must_be => [‘erteilt’] }, is ignored!

Is the syntax incorrect? Or can this condition not be implemented with the extension?

By the way, this is what it looks like in the RT config (/Admin/Tools/Configuration.html):
MandatoryOnTransition {
‘PK GEE Akquise’ => {
‘* -> resolved’ => [
‘CF.GEE’
],
‘* -> rejected’ => [
‘CF.GEE’
],
‘CF.GEE’ => {
‘transition’ => ‘* -> rejected’,
‘must_be’ => [
‘verweigert’
]
}
}
}

Tested with:
RT 4.2.16
Debian 8.11
MariaDB 10.1.43

Best,
Patrick

Since the transition and must_be bit are in a hash I do not believe you could have multiple values since there can only be one value for the ‘CF.GEE’ key

Not an extension we use, but could you put the value for the ‘CF.GEE’ hash key in as an array I wonder? Something like:

MandatoryOnTransition {
    'PK GEE Akquise' => {
        '* -> resolved' => [ 'CF.GEE'],
        '* -> rejected' => [ 'CF.GEE' ],
        'CF.GEE' => [
            { 'transition' => '* -> rejected', 'must_be' => [ 'verweigert' ] },
            { 'transition' => '* -> resolved', 'must_be' => [ 'erteilt' ] }
        ]
    }
}

Just a thought. The data structure is valid Perl, but I don’t know if the extension will be able to handle an array of hashes instead of just a hash.

Thank you for your suggestion, GreenJimll. Unfortunately the solution leads to the following error message:

23954] [Thu Jan 23 14:46:37 2020] [error]: Not a HASH reference at /opt/rt4/local/plugins/RT-Extension-MandatoryOnTransition/lib/RT/Extension/MandatoryOnTransition.pm line 373.

Thank you, Knation. I ran some more tests and I’m afraid you’re right.