Use customFields extracted by ExtractCustomFieldValues in creation mail

Hello,

I have a working instance of RT 4.2.9. Everything has been running as
expected for years (started with RT 3.8). I have a few queues that use
custom fields. Upon the creation of a new ticket, a mail is sent to the
queue administrator with the list of the queue’s custom fields and their
value and the body of the ticket. This works well when the ticket is
created from RT.

Now, I have been trying to use the ExtractCustomFieldValues extension to
extract my custom fields from an email. That actually works. The custom
fields are set properly in the ticket but in the mail sent to the queue
admins, the custom fields value are missing.

In my template (which works fine when the ticket is created from RT) I
used the following code:

{
my $res = “”;
my $customFields = $Ticket->QueueObj->TicketCustomFields();
while ( my $customField = $customFields->Next) {
$res.= $customField->Name.“:
“.$Ticket->FirstCustomFieldValue($customField->Name).”\n”;
}
$res;
}

I am also sure that my extractCustomField scrip is being executed
before my oncreation scrip (scrip #50 is my extractcustomvalue scrip
and scrip #15 my “oncreation sent mail to queue admins”:

Feb 6 17:14:21 rt4 RT: [19913] Committing scrip #50 on txn #90275 of
ticket #3782 (/opt/rt4/sbin/…/lib/RT/Scrips.pm:306)

Feb 6 17:14:21 rt4 RT: [19913] CustomFieldValue (Numéro de porte,123)
added: 5355 Numéro de porte 123 added

Feb 6 17:14:21 rt4 RT: [19913] CustomFieldValue (UMR,915) added: 5356
UMR 915 added

Feb 6 17:14:21 rt4 RT: [19913] CustomFieldValue (Numéro de
téléphone,123) added: 5357 Numéro de téléphone 123 added

Feb 6 17:14:21 rt4 RT: [19913] Committing scrip #15 on txn #90275 of
ticket #3782 (/opt/rt4/sbin/…/lib/RT/Scrips.pm:306)
Feb 6 17:14:21 rt4 RT: [19913] Calling SetRecipientDigests for
transaction RT::Transaction=HASH(0x7f91d5eadf40), id 90275
(/opt/rt4/sbin/…/lib/RT/Action/SendEmail.pm:623)

The log confirms the customfield are set before the mail is sent so why
aren’t the values set when queried from my template?

Thanks in advance,

Arnaud Abélard

Arnaud Abélard (jabber: arnaud.abelard@univ-nantes.fr)
Administrateur Système - Responsable Services Web
Direction des Systèmes d’Informations
Université de Nantes
ne pas utiliser: trapemail@univ-nantes.fr

Arnaud,

You need to make sure the scrips are running in the right sequence. You
do this by setting the execution to " transaction batch" and give them
names that ensure the correct sequence.

KennSent: ‎2/‎6/‎2015 8:29 AM
To: rt-users@lists.bestpractical.com
Subject: [rt-users] use customFields extracted by
ExtractCustomFieldValues in creation mail
Hello,

I have a working instance of RT 4.2.9. Everything has been running as
expected for years (started with RT 3.8). I have a few queues that use
custom fields. Upon the creation of a new ticket, a mail is sent to the
queue administrator with the list of the queue’s custom fields and their
value and the body of the ticket. This works well when the ticket is
created from RT.

Now, I have been trying to use the ExtractCustomFieldValues extension to
extract my custom fields from an email. That actually works. The custom
fields are set properly in the ticket but in the mail sent to the queue
admins, the custom fields value are missing.

In my template (which works fine when the ticket is created from RT) I
used the following code:

{
my $res = “”;
my $customFields = $Ticket->QueueObj->TicketCustomFields();
while ( my $customField = $customFields->Next) {
$res.= $customField->Name.“:
“.$Ticket->FirstCustomFieldValue($customField->Name).”\n”;
}
$res;
}

I am also sure that my extractCustomField scrip is being executed
before my oncreation scrip (scrip #50 is my extractcustomvalue scrip
and scrip #15 my “oncreation sent mail to queue admins”:

Feb 6 17:14:21 rt4 RT: [19913] Committing scrip #50 on txn #90275 of
ticket #3782 (/opt/rt4/sbin/…/lib/RT/Scrips.pm:306)

Feb 6 17:14:21 rt4 RT: [19913] CustomFieldValue (Numéro de porte,123)
added: 5355 Numéro de porte 123 added

Feb 6 17:14:21 rt4 RT: [19913] CustomFieldValue (UMR,915) added: 5356
UMR 915 added

Feb 6 17:14:21 rt4 RT: [19913] CustomFieldValue (Numéro de
téléphone,123) added: 5357 Numéro de téléphone 123 added

Feb 6 17:14:21 rt4 RT: [19913] Committing scrip #15 on txn #90275 of
ticket #3782 (/opt/rt4/sbin/…/lib/RT/Scrips.pm:306)
Feb 6 17:14:21 rt4 RT: [19913] Calling SetRecipientDigests for
transaction RT::Transaction=HASH(0x7f91d5eadf40), id 90275
(/opt/rt4/sbin/…/lib/RT/Action/SendEmail.pm:623)

The log confirms the customfield are set before the mail is sent so why
aren’t the values set when queried from my template?

Thanks in advance,

Arnaud Abélard

Arnaud Abélard (jabber: arnaud.abelard@univ-nantes.fr)
Administrateur Système - Responsable Services Web
Direction des Systèmes d’Informations
Université de Nantes
ne pas utiliser: trapemail@univ-nantes.fr

Arnaud,

You need to make sure the scrips are running in the right sequence. You
do this by setting the execution to " transaction batch" and give them
names that ensure the correct sequence.

Thanks Kenneth, took me a while to find how to put a scrip in
transactionbatch mode, but it works!

Arnaud

Kenn

Sent from my Windows PhoneFrom: Arnaud Abélard
Sent: ‎2/‎6/‎2015 8:29 AM
To: rt-users@lists.bestpractical.com
Subject: [rt-users] use customFields extracted by
ExtractCustomFieldValues in creation mail
Hello,

I have a working instance of RT 4.2.9. Everything has been running as
expected for years (started with RT 3.8). I have a few queues that use
custom fields. Upon the creation of a new ticket, a mail is sent to the
queue administrator with the list of the queue’s custom fields and their
value and the body of the ticket. This works well when the ticket is
created from RT.

Now, I have been trying to use the ExtractCustomFieldValues extension to
extract my custom fields from an email. That actually works. The custom
fields are set properly in the ticket but in the mail sent to the queue
admins, the custom fields value are missing.

In my template (which works fine when the ticket is created from RT) I
used the following code:

{
my $res = “”;
my $customFields = = ;
while ( my $customField = $customFields->Next) {
$res.= $customField->Name.“:
“.$Ticket->FirstCustomFieldValue($customField->Name).”\n”;
}
$res;
}

I am also sure that my extractCustomField scrip is being executed
before my oncreation scrip (scrip #50 is my extractcustomvalue scrip
and scrip #15 my “oncreation sent mail to queue admins”:

Feb 6 17:14:21 rt4 RT: [19913] Committing scrip #50 on txn #90275 of
ticket #3782 (/opt/rt4/sbin/…/lib/RT/Scrips.pm:306)

Feb 6 17:14:21 rt4 RT: [19913] CustomFieldValue (Numéro de porte,123)
added: 5355 Numéro de porte 123 added

Feb 6 17:14:21 rt4 RT: [19913] CustomFieldValue (UMR,915) added: 5356
UMR 915 added

Feb 6 17:14:21 rt4 RT: [19913] CustomFieldValue (Numéro de
téléphone,123) added: 5357 Numéro de téléphone 123 added

Feb 6 17:14:21 rt4 RT: [19913] Committing scrip #15 on txn #90275 of
ticket #3782 (/opt/rt4/sbin/…/lib/RT/Scrips.pm:306)
Feb 6 17:14:21 rt4 RT: [19913] Calling SetRecipientDigests for
transaction RT::Transaction=HASH(0x7f91d5eadf40), id 90275
(/opt/rt4/sbin/…/lib/RT/Action/SendEmail.pm:623)

The log confirms the customfield are set before the mail is sent so why
aren’t the values set when queried from my template?

Thanks in advance,

Arnaud Abélard

Arnaud Abélard (jabber: arnaud.abelard@univ-nantes.fr)
Administrateur Système - Responsable Services Web
Direction des Systèmes d’Informations
Université de Nantes
ne pas utiliser: trapemail@univ-nantes.fr