Set Subject in if/then clause

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,
I’m trying to set up a different subject for different queues in the
same template (autoreply). This doesn’t seem to work:

{
if ($Ticket->QueueObj->Name eq ‘Work Queue’) {
“Output this”;
}
elsif ($Ticket->QueueObj->Name eq ‘Task Queue’) {
“Output that”;
}
else {
“Output other”;
}
}

Is there a way to get this work?

Thanks,
Giuseppe


Giuseppe Sollazzo
Senior Systems Analyst
Computing Services
Information Services
St. George’s, University Of London
Cranmer Terrace
London SW17 0RE

Email: gsollazz@sgul.ac.uk
Direct Dial: +44 20 8725 5160
Fax: +44 20 8725 3583

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPKRwCAAoJEAqigArPBfJXFCwH/iHe/oMnhx4fUV3AT4r55VFM
PZHTLycb7mgsG1Nd4N0aIV3EQoGLIXe2YH1GaJIHLbs58q49r/fhzghjRYSGAYDt
byk1NZGSXbItHwKM5D/cHX6xp/4SYDEeybtgCRbYKI51WsGIc7pX71TRjqQfNspv
I5t4Pniq8VweKtl6y46eJiZK2cUVYTFmEy51xd32R+p1i5quw4BXV/oAWhC27+AT
TlsNCnGye8BUD7NA0GAcaGzKCyKnMIJDbNm9ye14aEr6D/5+QXD2FoTxldI9EX7p
qCUOYC+g4o+rBihSpEK5dUH4pJ3wbidBfI1plMLopkTFLI4BSy/8lXqD4bwQzpA=
=OqSg
-----END PGP SIGNATURE-----

I am pretty sure you can define that on the queue edit screen. I set up different subject prefixes per queue when I created them. As long as it is a per queue difference and not changes within a queue based on something else.

Someone correct me if I’m wrong.On Feb 1, 2012, at 6:03 AM, Giuseppe Sollazzo gsollazz@sgul.ac.uk wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,
I’m trying to set up a different subject for different queues in the
same template (autoreply). This doesn’t seem to work:

{
if ($Ticket->QueueObj->Name eq ‘Work Queue’) {
Subject: Helpdesk Job Logged: {$Ticket->Subject}
“Output this”;
}
elsif ($Ticket->QueueObj->Name eq ‘Task Queue’) {
Subject: Support Job Logged: {$Ticket->Subject}
“Output that”;
}
else {
“Output other”;
}
}

Is there a way to get this work?

Thanks,
Giuseppe



Giuseppe Sollazzo
Senior Systems Analyst
Computing Services
Information Services
St. George’s, University Of London
Cranmer Terrace
London SW17 0RE

Email: gsollazz@sgul.ac.uk
Direct Dial: +44 20 8725 5160
Fax: +44 20 8725 3583

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPKRwCAAoJEAqigArPBfJXFCwH/iHe/oMnhx4fUV3AT4r55VFM
PZHTLycb7mgsG1Nd4N0aIV3EQoGLIXe2YH1GaJIHLbs58q49r/fhzghjRYSGAYDt
byk1NZGSXbItHwKM5D/cHX6xp/4SYDEeybtgCRbYKI51WsGIc7pX71TRjqQfNspv
I5t4Pniq8VweKtl6y46eJiZK2cUVYTFmEy51xd32R+p1i5quw4BXV/oAWhC27+AT
TlsNCnGye8BUD7NA0GAcaGzKCyKnMIJDbNm9ye14aEr6D/5+QXD2FoTxldI9EX7p
qCUOYC+g4o+rBihSpEK5dUH4pJ3wbidBfI1plMLopkTFLI4BSy/8lXqD4bwQzpA=
=OqSg
-----END PGP SIGNATURE-----


RT Training Sessions (http://bestpractical.com/services/training.html)

  • Boston March 5 & 6, 2012

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I am pretty sure you can define that on the queue edit screen. I
set up different subject prefixes per queue when I created them. As
long as it is a per queue difference and not changes within a queue
based on something else.

Someone correct me if I’m wrong.

Sent from my mobile device.

Hi Joe,

thanks for that. Your suggestion changes only the SubjectTag, though.

What I’d like to understand is if my solution can be made to work - or
if there’s any reason why it shouldn’t. I might need to do more
versatile stuff than just adapting the Subject in that very simple
way, so if there’s anyone who can recommend how to do so, please let
me know.

Thanks,
Giuseppe

Hi, I’m trying to set up a different subject for different queues
in the same template (autoreply). This doesn’t seem to work:

{ if ($Ticket->QueueObj->Name eq ‘Work Queue’) { Subject: Helpdesk
Job Logged: {$Ticket->Subject} “Output this”; } elsif
($Ticket->QueueObj->Name eq ‘Task Queue’) { Subject: Support Job
Logged: {$Ticket->Subject} “Output that”; } else { “Output other”;
} }

Is there a way to get this work?

Thanks, Giuseppe


RT Training Sessions (http://bestpractical.com/services/training.html)

  • Boston March 5 & 6, 2012

Giuseppe Sollazzo
Senior Systems Analyst
Computing Services
Information Services
St. George’s, University Of London
Cranmer Terrace
London SW17 0RE

Email: gsollazz@sgul.ac.uk
Direct Dial: +44 20 8725 5160
Fax: +44 20 8725 3583

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPKThCAAoJEAqigArPBfJXjiQIAJCAiGyjVuPdmI5qXmRpgKZ9
TAAlcdfM0EUbBw0mamJcscJUbi9Um5n+FfDz6k+UjRceTTzO41O4Vfr60UA1o5t3
SKEZtmizh+jZSAXZm8hojCJC6GKz270XXlGDFkc3GJ65HNnb6KAFzftUAUHT35bv
hLYB+urx6JU2rmo4uXMp9bRU3YSPcLMOg5v/jdpyeEarWWUR19WzDbaJix4XcxVG
KgCgpojLjP6Y2Y1afzu4MZVShhmJzbpT/w2UGRiwvNtMWrm9ZHSaRMSgmd8KgYLd
a3XZEManmvQYrJWvJ7Zsx9x+f56yvW47/lomOlqIK8xkmiLYIxCTm7RfvYJWjRY=
=52Sp
-----END PGP SIGNATURE-----

Hi Giuseppe

what is your definition of “This doesn’t seem to work” ?
what is the (bad) behaviour that you are seeing ?
Does an email get sent or not ?
What is its subject line and content ?
Anything in the logs ?

GerardOn 2012-02-01 12:03, Giuseppe Sollazzo wrote:

Hi,
I’m trying to set up a different subject for different queues in the
same template (autoreply). This doesn’t seem to work:

{
if ($Ticket->QueueObj->Name eq ‘Work Queue’) {
Subject: Helpdesk Job Logged: {$Ticket->Subject}
“Output this”;
}
elsif ($Ticket->QueueObj->Name eq ‘Task Queue’) {
Subject: Support Job Logged: {$Ticket->Subject}
“Output that”;
}
else {
“Output other”;
}
}

Is there a way to get this work?

Thanks,
Giuseppe

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Giuseppe

what is your definition of “This doesn’t seem to work” ? what is
the (bad) behaviour that you are seeing ? Does an email get sent or
not ? What is its subject line and content ? Anything in the logs
?

Gerard

Hi Gerard,

I should have been clearer but I thought it was evident: the “Subject”
line is not valid Perl, so you can’t compile a script built that way.

The question is if there’s a standard way to add that directive (a
non-Perl one) within the if-clause.

Thanks,
Giuseppe> On 2012-02-01 12:03, Giuseppe Sollazzo wrote:

Hi, I’m trying to set up a different subject for different queues
in the same template (autoreply). This doesn’t seem to work:

{ if ($Ticket->QueueObj->Name eq ‘Work Queue’) { Subject:
Helpdesk Job Logged: {$Ticket->Subject} “Output this”; } elsif
($Ticket->QueueObj->Name eq ‘Task Queue’) { Subject: Support Job
Logged: {$Ticket->Subject} “Output that”; } else { “Output
other”; } }

Is there a way to get this work?

Thanks, Giuseppe

-------- RT Training Sessions
(http://bestpractical.com/services/training.html) * Boston March 5
& 6, 2012


Giuseppe Sollazzo
Senior Systems Analyst
Computing Services
Information Services
St. George’s, University Of London
Cranmer Terrace
London SW17 0RE

Email: gsollazz@sgul.ac.uk
Direct Dial: +44 20 8725 5160
Fax: +44 20 8725 3583

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPKTumAAoJEAqigArPBfJXdDgH/A1YiWhrj9/ZutVcvP6pYr+4
dYEYG2kK+usaLVdl5hwsSKhITC7hBvEdHBrNocNbFNJERBMSq6+Uj4SJAWKF7K+c
cqc69Uo13VjYjnVECSZVU/NhOG4Xiy0+zJssHmeZN+tDuN7OfBcF309zVfQceveH
i/YBNsuc0yY8X9MVnLg4EgymNDZrezfGOJDbLlUDSeD9lDN9SeCvSH0jsRR3UPYq
f2N0+88mQp+5KwtR/NMN88fX44uBUk3JOJobIrRPtv3Ti7spocXQBZ6JXP52e7Pi
0XFkbcI3JMTYa9voPKHHD7dxkk7/ToAILXIpRP4cIodlDTlGy7ZNnsLH1HZIhzI=
=x7YS
-----END PGP SIGNATURE-----

Try something like

{ “Helpdesk Job Logged: {$Ticket->Subject} Output this”; }
elsif ($Ticket->QueueObj->Name eq ‘Task Queue’)
{ “Support Job Logged: {$Ticket->Subject} Output that”; }
else
{ “Output other”; }
}

In other words, your perl script should return a string.

GerardOn 2012-02-01 14:18, Giuseppe Sollazzo wrote:

On 01/02/12 13:08, Gerard FENELON wrote:

Hi Giuseppe

what is your definition of “This doesn’t seem to work” ? what is
the (bad) behaviour that you are seeing ? Does an email get sent or
not ? What is its subject line and content ? Anything in the logs
?

Gerard
Hi Gerard,

I should have been clearer but I thought it was evident: the "Subject"
line is not valid Perl, so you can’t compile a script built that way.

The question is if there’s a standard way to add that directive (a
non-Perl one) within the if-clause.

Thanks,
Giuseppe

On 2012-02-01 12:03, Giuseppe Sollazzo wrote:

Hi, I’m trying to set up a different subject for different queues
in the same template (autoreply). This doesn’t seem to work:

{ if ($Ticket->QueueObj->Name eq ‘Work Queue’) { Subject:
Helpdesk Job Logged: {$Ticket->Subject} “Output this”; } elsif
($Ticket->QueueObj->Name eq ‘Task Queue’) { Subject: Support Job
Logged: {$Ticket->Subject} “Output that”; } else { “Output
other”; } }

Is there a way to get this work?

Thanks, Giuseppe

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1On 01/02/12 13:30, Gerard FENELON wrote:

Try something like

Subject: { if ($Ticket->QueueObj->Name eq ‘Work Queue’) { “Helpdesk
Job Logged: {$Ticket->Subject} Output this”; } elsif
($Ticket->QueueObj->Name eq ‘Task Queue’) { “Support Job Logged:
{$Ticket->Subject} Output that”; } else { “Output other”; } }

In other words, your perl script should return a string.

Gerard

Hi Gerard,
I begin to understand.

However, there is a problem with the {$Ticket->Subject} which I’m not
sure I know how to deal with

I get a subject line like:
Helpdesk Job Logged: {RT::Ticket=HASH(0x1034ec88)->Subject} Output that

which suggests the compiler is getting the object as a pointer rather
than its content. Any idea?

Thanks,
Giuseppe


Giuseppe Sollazzo
Senior Systems Analyst
Computing Services
Information Services
St. George’s, University Of London
Cranmer Terrace
London SW17 0RE

Email: gsollazz@sgul.ac.uk
Direct Dial: +44 20 8725 5160
Fax: +44 20 8725 3583

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPKUItAAoJEAqigArPBfJXlsMH/juz/RJQ6jq+UZoVGfsEk7G2
tpVIX1aUX8CSUq1YXd0I5VyULEqFAJechFJUi997b/LHp4CjtCPKHpNBpeE/TQW0
GsELSs623ie6HcVXY9LLkr5ZQNiugbYbIIBH067vJvf+JNg0B/cvkVI82nPbOAGI
FxRk2Z1ZNr5wmzxbayngAnpjY4pV1ulGz/2Hiwla3LAmf1UbSfCQPFi5Ystqq+BZ
/429yaA8UlFz5v94YaxqEUZukf7Q8Vc33rnVICRdEgg0aPec/CtHLxJNyBu/3fm/
RTyppExdD8wKvoQDKs9Iax7J6B+2FTLQpHp7QCv1goS51hd/o1Cij6D3wqgDT1E=
=PwsE
-----END PGP SIGNATURE-----

I suspect my proposal is wrong
Try instead

{ "Helpdesk Job Logged: " . $Ticket->Subject . " Output this"; }
elsif ($Ticket->QueueObj->Name eq 'Task Queue')
{ "Support Job Logged: " . $Ticket->Subject . " Output that"; }
else
{ "Output other"; }
}

GerardOn 2012-02-01 14:30, Gerard FENELON wrote:

Try something like

Subject: { if ($Ticket->QueueObj->Name eq ‘Work Queue’)
{ “Helpdesk Job Logged: {$Ticket->Subject} Output this”; }
elsif ($Ticket->QueueObj->Name eq ‘Task Queue’)
{ “Support Job Logged: {$Ticket->Subject} Output that”; }
else
{ “Output other”; }
}

In other words, your perl script should return a string.

Gerard

On 2012-02-01 14:18, Giuseppe Sollazzo wrote:

On 01/02/12 13:08, Gerard FENELON wrote:

Hi Giuseppe

what is your definition of “This doesn’t seem to work” ? what is
the (bad) behaviour that you are seeing ? Does an email get sent or
not ? What is its subject line and content ? Anything in the logs
?

Gerard
Hi Gerard,

I should have been clearer but I thought it was evident: the “Subject”
line is not valid Perl, so you can’t compile a script built that way.

The question is if there’s a standard way to add that directive (a
non-Perl one) within the if-clause.

Thanks,
Giuseppe

On 2012-02-01 12:03, Giuseppe Sollazzo wrote:

Hi, I’m trying to set up a different subject for different queues
in the same template (autoreply). This doesn’t seem to work:

{ if ($Ticket->QueueObj->Name eq ‘Work Queue’) { Subject:
Helpdesk Job Logged: {$Ticket->Subject} “Output this”; } elsif
($Ticket->QueueObj->Name eq ‘Task Queue’) { Subject: Support Job
Logged: {$Ticket->Subject} “Output that”; } else { “Output
other”; } }

Is there a way to get this work?

Thanks, Giuseppe


RT Training Sessions (http://bestpractical.com/services/training.html)

  • Boston March 5 & 6, 2012

Gerard FENELON Corporate Support
Emulation& Verification Engineering
2 bis, voie La Cardon
phone: +33 1 6453 2734 Parc Gutenberg
fax: +33 1 6453 2740 91120 Palaiseau
http://www.eve-team.com FRANCE

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Gerard,
many thanks - that worked.

I really need to refresh my Perl…

Cheers,
GiuseppeOn 01/02/12 13:49, Gerard FENELON wrote:

I suspect my proposal is wrong Try instead

Subject: { if ($Ticket->QueueObj->Name eq ‘Work Queue’) { “Helpdesk
Job Logged: " . $Ticket->Subject . " Output this”; } elsif
($Ticket->QueueObj->Name eq ‘Task Queue’) { “Support Job Logged: "
. $Ticket->Subject . " Output that”; } else { “Output other”; } }

Gerard


Giuseppe Sollazzo
Senior Systems Analyst
Computing Services
Information Services
St. George’s, University Of London
Cranmer Terrace
London SW17 0RE

Email: gsollazz@sgul.ac.uk
Direct Dial: +44 20 8725 5160
Fax: +44 20 8725 3583

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPKURWAAoJEAqigArPBfJX1IsIAJAdOa4b89lPwNIj5mfInbs6
ItG4KHAA8CbzrUQ22bcNxO7JS1UaVnoRb+gZZkyDy5r4hiyuHu7BjBE5EscwF2So
/Zm0Q9iX7DIGorIHNzfiDxW9qkLE8aCjLOMMDxaG//RMIpmzPgtHXvzNc2bjYFIM
2V5IxZoC/tVdrpDUsKnyiytWQWMGI8nn+rSejr0xaZV/zI7wvXaAdEPPZdA94N20
GIP8JGdGF4NhGLBPm+8Vvshw/k3cKV2WDEze2yNhY3z0uHmGpi2ECjkH8QuuQOZU
BzetFR8VzAi4JElb05PwKkT+BKmOnM1YeOizXaao3JnWJ6Gg/Jcu5hEZZlBWUsc=
=YrLQ
-----END PGP SIGNATURE-----

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Gerard,
many thanks - that worked.

I really need to refresh my Perl…

Cheers,
Giuseppe

I suspect my proposal is
wrong Try instead

     >

     > Subject: { if ($Ticket->QueueObj->Name eq 'Work
     Queue') { "Helpdesk

     > Job Logged: " . $Ticket->Subject . " Output this"; }
     elsif

     > ($Ticket->QueueObj->Name eq 'Task Queue') { "Support
     Job Logged: "

     > . $Ticket->Subject . " Output that"; } else { "Output
     other"; } }

     >

     > Gerard

Guiseppe - for reference, the syntax Gerard gave you came from the
fact that RT’s templates are Text::Templates and you can read more
about them on CPAN:

-kevin

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Guiseppe - for reference, the syntax Gerard gave you came from the
fact that RT’s templates are Text::Templates and you can read more
about them on CPAN:

Text::Template - Expand template text with embedded Perl - metacpan.org

Hi Kevin - that’s what I was missing! This is very useful for further
developments. Many thanks!

G

-kevin


RT Training Sessions (http://bestpractical.com/services/training.html)

  • Boston ? March 5 & 6, 2012

Giuseppe Sollazzo
Senior Systems Analyst
Computing Services
Information Services
St. George’s, University Of London
Cranmer Terrace
London SW17 0RE

Email: gsollazz@sgul.ac.uk
Direct Dial: +44 20 8725 5160
Fax: +44 20 8725 3583

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPKk6LAAoJEAqigArPBfJXnrUH/12aMtr+ZDAr7nz6vXES730K
ESRKexikKHORLlcD9sSSTy54xgCsW64XKleHdK78bZnml93wKkVwF2UYo7w596d1
KuqcmgKgF6GUfPNXsn8nDQ6VfMgmoAPpBdk1JaB2fsBkf6ejT3SWftq1uzePcy+k
f7Z8VZNW1w6CnkfE5G2rUCTJWr4KhEoWOKXG45GXhqp7MLmtwJTXJwiCICvOk73C
U/hrE/ez7xuVePKRXsHP4+FfrMZPvVd2yOmkvXRj2eIz9rVMbuBkjrOSuXG4VLbQ
hK8MJhGpJJGzusckaalIp3INpeWX/RA8ik4pnzCtU27njQedbDx/B6uwocQAP6M=
=rtya
-----END PGP SIGNATURE-----