Conditional template usage

I am trying to create a script with a custom condition that runs upon
ticket creation. Depending on the value of a user-defined field, the
scrip should use one template or another.

So far, in my Custom Condition I have:

if ($self->TransactionObj->Type eq “Create”){

if ($self->TicketObj->FirstCustomFieldValue(‘Parent Company’) eq
’MY_COMPANY’){

LOAD TEMPLATE

} else {

LOAD DIFFERENT TEMPLATE

}

return 1;

}

else{

return undef;

}

Does this look right? What do I need to add in place of “# LOAD
TEMPLATE #” to get the scrip to load a template?

Thanks,
Craig

THE INFORMATION CONTAINED IN THIS MESSAGE AND ANY ATTACHMENT MAY BE PRIVILEGED, CONFIDENTIAL, PROPRIETARY OR OTHERWISE PROTECTED FROM DISCLOSURE. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, copying or use of this message and any attachment is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and permanently delete it from your computer and destroy any printout thereof.

I think easiest way is to create two scrips. As I can see you couldn’t
change template from condition.On 5/16/06, Bloom, Craig Craig.Bloom@blackrock.com wrote:

I am trying to create a script with a custom condition that runs upon ticket
creation. Depending on the value of a user-defined field, the scrip should
use one template or another.

So far, in my Custom Condition I have:

if ($self->TransactionObj->Type eq “Create”){

if ($self->TicketObj->FirstCustomFieldValue(‘Parent
Company’) eq ‘MY_COMPANY’){

LOAD TEMPLATE

} else {

LOAD DIFFERENT TEMPLATE

}

return 1;

}

else{

return undef;

}

Does this look right? What do I need to add in place of "# LOAD TEMPLATE #"
to get the scrip to load a template?

Thanks,
Craig

THE INFORMATION CONTAINED IN THIS MESSAGE AND ANY ATTACHMENT MAY BE
PRIVILEGED, CONFIDENTIAL, PROPRIETARY OR OTHERWISE PROTECTED FROM
DISCLOSURE. If the reader of this message is not the intended recipient, you
are hereby notified that any dissemination, distribution, copying or use of
this message and any attachment is strictly prohibited. If you have received
this message in error, please notify us immediately by replying to the
message and permanently delete it from your computer and destroy any
printout thereof.


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

We’re hiring! Come hack Perl for Best Practical:
http://bestpractical.com/about/jobs.html

Best regards, Ruslan.

That is really my question - how can you change/load a template from
inside a custom condition?

If I have two separate scripts with two separate custom conditions, I
will still need to know how to load a the appropriate template.

Any more thoughts?

Thanks,
CraigFrom: Ruslan Zakirov [mailto:ruslan.zakirov@gmail.com]
Sent: Tuesday, May 16, 2006 4:45 PM
To: Bloom, Craig
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] conditional template usage

I think easiest way is to create two scrips. As I can see you couldn’t
change template from condition.

I am trying to create a script with a custom condition that runs upon
ticket
creation. Depending on the value of a user-defined field, the scrip
should
use one template or another.

So far, in my Custom Condition I have:

if ($self->TransactionObj->Type eq “Create”){

if ($self->TicketObj->FirstCustomFieldValue(‘Parent
Company’) eq ‘MY_COMPANY’){

LOAD TEMPLATE

} else {

LOAD DIFFERENT TEMPLATE

}

return 1;

}

else{

return undef;

}

Does this look right? What do I need to add in place of "# LOAD
TEMPLATE #"
to get the scrip to load a template?

Thanks,
Craig

THE INFORMATION CONTAINED IN THIS MESSAGE AND ANY ATTACHMENT MAY BE
PRIVILEGED, CONFIDENTIAL, PROPRIETARY OR OTHERWISE PROTECTED FROM
DISCLOSURE. If the reader of this message is not the intended
recipient, you
are hereby notified that any dissemination, distribution, copying or
use of
this message and any attachment is strictly prohibited. If you have
received
this message in error, please notify us immediately by replying to the
message and permanently delete it from your computer and destroy any
printout thereof.


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

We’re hiring! Come hack Perl for Best Practical:
http://bestpractical.com/about/jobs.html

Best regards, Ruslan.

THE INFORMATION CONTAINED IN THIS MESSAGE AND ANY ATTACHMENT MAY BE PRIVILEGED, CONFIDENTIAL, PROPRIETARY OR OTHERWISE PROTECTED FROM DISCLOSURE. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, copying or use of this message and any attachment is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and permanently delete it from your computer and destroy any printout thereof.

That is really my question - how can you change/load a template from
inside a custom condition?
I think no way without patching.

If I have two separate scripts with two separate custom conditions, I
will still need to know how to load a the appropriate template.

no, as you can create next scrips:

  • “when we want use template1 do an action with template1”
  • “when we want use template2 do the same action with template2”

Any more thoughts?

Thanks,
Craig

-----Original Message-----
From: Ruslan Zakirov [mailto:ruslan.zakirov@gmail.com]
Sent: Tuesday, May 16, 2006 4:45 PM
To: Bloom, Craig
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] conditional template usage

I think easiest way is to create two scrips. As I can see you couldn’t
change template from condition.

I am trying to create a script with a custom condition that runs upon
ticket
creation. Depending on the value of a user-defined field, the scrip
should
use one template or another.

So far, in my Custom Condition I have:

if ($self->TransactionObj->Type eq “Create”){

if ($self->TicketObj->FirstCustomFieldValue(‘Parent
Company’) eq ‘MY_COMPANY’){

LOAD TEMPLATE

} else {

LOAD DIFFERENT TEMPLATE

}

return 1;

}

else{

return undef;

}

Does this look right? What do I need to add in place of "# LOAD
TEMPLATE #"
to get the scrip to load a template?

Thanks,
Craig

THE INFORMATION CONTAINED IN THIS MESSAGE AND ANY ATTACHMENT MAY BE
PRIVILEGED, CONFIDENTIAL, PROPRIETARY OR OTHERWISE PROTECTED FROM
DISCLOSURE. If the reader of this message is not the intended
recipient, you
are hereby notified that any dissemination, distribution, copying or
use of
this message and any attachment is strictly prohibited. If you have
received
this message in error, please notify us immediately by replying to the
message and permanently delete it from your computer and destroy any
printout thereof.


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

We’re hiring! Come hack Perl for Best Practical:
http://bestpractical.com/about/jobs.html


Best regards, Ruslan.

THE INFORMATION CONTAINED IN THIS MESSAGE AND ANY ATTACHMENT MAY BE PRIVILEGED, CONFIDENTIAL, PROPRIETARY OR OTHERWISE PROTECTED FROM DISCLOSURE. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, copying or use of this message and any attachment is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and permanently delete it from your computer and destroy any printout thereof.

Best regards, Ruslan.

I think easiest way is to create two scrips. As I can see you couldn’t
change template from condition.

Maybe an alternative might be to use the same template but put the conditional
test there instead?

Duncan

I think easiest way is to create two scrips. As I can see you couldn’t
change template from condition.

Maybe an alternative might be to use the same template but put the conditional
test there instead?
Yep, it’s also possible.

Duncan


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

We’re hiring! Come hack Perl for Best Practical: http://bestpractical.com/about/jobs.html

Best regards, Ruslan.