[rt-users] scrip condition on transaction custom field
Sebastian Juenemann
jueneman at CeBiTec.Uni-Bielefeld.de
Wed Feb 17 02:36:13 EST 2016
Hi everyone,
I have an issue which i can't get resolved without further help by
anyone more experienced RT user/admin.
I want to have a special trigger which can be activated during the
resolving stage on a ticket in order to decide whether an appropriate
message will be sent to the ticket requester or not. Feedback mails to
requester are generally deactivated. The idea is that RT users then can
resolve tickets as normal but if they want that a feedback mail shall be
send they can set the transaction CF to 'yes' and do so explicitly.
For this, I've crated a transaction custom field 'feedback', enabled it
for my queue, with selectable values 'yes' and 'no'. I've then created a
batch scrip (from what I've learned it must be batch if transaction CFs
shall be parsed) which checks for two conditions: 1) ticket was resolved
and 2) transaction CF 'feedback' is set to 'yes'. The first part works
perfectly fine, but i don't get the second part working. I've tried
dozens of different ways two access transactions CFs, but it just wont
work.
So here are some methods which i tried unsuccessfully so far:
1)
return 0 unless $self->TicketObj->FirstCustomFieldValue('feedback') eq
'yes'; # only on ticket CFs?
2)
my $cfs=$txn->CustomFieldValues;
my $cf = $cfs->LimitToCustomField('feedback');
my $response = $cf->Next;
return 0 unless $response->Content eq 'yes';
3)
my $cfvs=$txn->CustomFieldValues;
my $feedback = 0;
while (my $cfv = $cfvs->Next)
{
my $cfObj = $cfv->CustomFieldObj;
my $cf_name = $cfObj->Name;
my $cfv_name = $cfv->Name;
if ($cf_name eq 'feedback' && $cfv_name eq 'yes') {
$feedback = 1;
}
}
return 0 if $feedback == 0;
So my question is: how do i access the transaction CF of my last
transaction (i.e. a resolve transaction = comment + status change to
resolve) in a scrip condition?
I found the documentation on this specific topic (transaction CFs, not
tiecket CFs) quite incomplete and hope some of you will be able to help me.
Many thank sin advance!
- Sebastian
--
Sebastian Jünemann
CeBiTec - Center for Biotechnology
Bielefeld University, D-33594 Bielefeld, Germany
Office: V6-147 -- Phone: +49-(0)521-106-4827
eMail: jueneman at CeBiTec.Uni-Bielefeld.de
More information about the rt-users
mailing list