Change queue with a scrip before ticket creation

I need to be able to change the Queue that a ticket is going to before
it is created. Is this even possible with a scrip in RT? I tried a
scrip with an OnCreate condition and SetQueue, but it still created the
ticket in the original queue, then moved the ticket to the new queue
after it was created. Is what I want to do even possible with rt-3.8.7
without hacking the core RT code? Any help to point me in the right
direction would be greatly appreciated.

Thanks,
~Jason

/------------------------------------------------------------------
| Jason A. Smith Email: smithj4@bnl.gov |
| Atlas Computing Facility, Bldg. 510M Phone: +1-631-344-4226 |
| Brookhaven National Lab, P.O. Box 5000 Fax: +1-631-344-7616 |
| Upton, NY 11973-5000, U.S.A. |
------------------------------------------------------------------/

smime.p7s (3.88 KB)

Jason, scrips can not change what already happened.

You can use callback in Create.html, but ticket creation is hardly
tied to a queue because of custom fields.On Wed, Mar 3, 2010 at 2:06 AM, Jason A. Smith smithj4@bnl.gov wrote:

I need to be able to change the Queue that a ticket is going to before
it is created. Is this even possible with a scrip in RT? I tried a
scrip with an OnCreate condition and SetQueue, but it still created the
ticket in the original queue, then moved the ticket to the new queue
after it was created. Is what I want to do even possible with rt-3.8.7
without hacking the core RT code? Any help to point me in the right
direction would be greatly appreciated.

Thanks,
~Jason


/------------------------------------------------------------------
| Jason A. Smith Email: smithj4@bnl.gov |
| Atlas Computing Facility, Bldg. 510M Phone: +1-631-344-4226 |
| Brookhaven National Lab, P.O. Box 5000 Fax: +1-631-344-7616 |
| Upton, NY 11973-5000, U.S.A. |
------------------------------------------------------------------/


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

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

2010 RT Training Sessions!
San Francisco, CA, USA - Feb 22 & 23
Dublin, Ireland - Mar 15 & 16
Boston, MA, USA - April 5 & 6
Washington DC, USA - Oct 25 & 26

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

Best regards, Ruslan.

Jason, scrips can not change what already happened.

That’s what I thought, by the time the scrip is run, it is already too
late.

You can use callback in Create.html, but ticket creation is hardly
tied to a queue because of custom fields.

Interesting, sounds like it may be close to what I want, but it only has
an effect on the RT web interface. I would like to change the queue,
based on certain info in the message, and do this for any method of
ticket creation (email, web, rest).

I guess I would need to modify RT/Ticket_Overlay.pm, examine the
contents of MIMEObj and change the Queue parameter before SUPER::Create
is called.

Thanks,
~Jason> On Wed, Mar 3, 2010 at 2:06 AM, Jason A. Smith smithj4@bnl.gov wrote:

I need to be able to change the Queue that a ticket is going to before
it is created. Is this even possible with a scrip in RT? I tried a
scrip with an OnCreate condition and SetQueue, but it still created the
ticket in the original queue, then moved the ticket to the new queue
after it was created. Is what I want to do even possible with rt-3.8.7
without hacking the core RT code? Any help to point me in the right
direction would be greatly appreciated.

Thanks,
~Jason


/------------------------------------------------------------------
| Jason A. Smith Email: smithj4@bnl.gov |
| Atlas Computing Facility, Bldg. 510M Phone: +1-631-344-4226 |
| Brookhaven National Lab, P.O. Box 5000 Fax: +1-631-344-7616 |
| Upton, NY 11973-5000, U.S.A. |
------------------------------------------------------------------/


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

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

2010 RT Training Sessions!
San Francisco, CA, USA - Feb 22 & 23
Dublin, Ireland - Mar 15 & 16
Boston, MA, USA - April 5 & 6
Washington DC, USA - Oct 25 & 26

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

/------------------------------------------------------------------
| Jason A. Smith Email: smithj4@bnl.gov |
| Atlas Computing Facility, Bldg. 510M Phone: +1-631-344-4226 |
| Brookhaven National Lab, P.O. Box 5000 Fax: +1-631-344-7616 |
| Upton, NY 11973-5000, U.S.A. |
------------------------------------------------------------------/

smime.p7s (3.88 KB)

Jason, scrips can not change what already happened.

That’s what I thought, by the time the scrip is run, it is already too
late.

I suspect you do some extraction from content and then auto
classification of tickets. I don’t get why it’s too late.

You can use callback in Create.html, but ticket creation is hardly
tied to a queue because of custom fields.

Interesting, sounds like it may be close to what I want, but it only has
an effect on the RT web interface. I would like to change the queue,
based on certain info in the message, and do this for any method of
ticket creation (email, web, rest).

I guess I would need to modify RT/Ticket_Overlay.pm, examine the
contents of MIMEObj and change the Queue parameter before SUPER::Create
is called.

It’s possible, but is more complicated. Can you describe why moving
ticket between queues doesn’t work for you?

Thanks,
~Jason

Best regards, Ruslan.

Jason, scrips can not change what already happened.

That’s what I thought, by the time the scrip is run, it is already too
late.

I suspect you do some extraction from content and then auto
classification of tickets. I don’t get why it’s too late.

That is what I would like to do.

You can use callback in Create.html, but ticket creation is hardly
tied to a queue because of custom fields.

Interesting, sounds like it may be close to what I want, but it only has
an effect on the RT web interface. I would like to change the queue,
based on certain info in the message, and do this for any method of
ticket creation (email, web, rest).

I guess I would need to modify RT/Ticket_Overlay.pm, examine the
contents of MIMEObj and change the Queue parameter before SUPER::Create
is called.

It’s possible, but is more complicated. Can you describe why moving
ticket between queues doesn’t work for you?

The ticket would end up in the correct queue, but it generates some
unnecessary email in the process when the admin watchers of the original
queue are notified about the new ticket in their queue when it is
created, when in fact it isn’t meant for them, unless this can be
suppressed when the needed queue move is detected. Will a false return
from the custom action prep code prevent this? I guess I need to refer
to my RT Essentials book again, tomorrow morning since it is in my
office.

Also, the default queue change template is just a basic change
notification, so it doesn’t contain the original problem description. I
suppose with some extra logic, the original problem description could be
added to some (or maybe all) of the queue change notification emails.

I will have to play with this some more tomorrow.

Thanks,
~Jason

/------------------------------------------------------------------
| Jason A. Smith Email: smithj4@bnl.gov |
| Atlas Computing Facility, Bldg. 510M Phone: +1-631-344-4226 |
| Brookhaven National Lab, P.O. Box 5000 Fax: +1-631-344-7616 |
| Upton, NY 11973-5000, U.S.A. |
------------------------------------------------------------------/

smime.p7s (3.88 KB)

Here we used the following method:

  • an incoming queue without watchers, without anything except a scrip
    that dispatch tickets in others queues
  • a fallback error queue with admins as watcher in case the dispatch
    cannot be done.
  • a scrip that trigger on queue change in every queues except incoming
    queue to do usual oncreate things

I suspect you do some extraction from content and then auto
classification of tickets.

That is what I would like to do.

Can you do the processing/classification in procmail and have that deliver the mail straight into the correct queue?

Cheers
Toby

LEGAL NOTICE
Unless expressly stated otherwise, information contained in this
message is confidential. If this message is not intended for you,
please inform postmaster@ccdc.cam.ac.uk and delete the message.
The Cambridge Crystallographic Data Centre is a company Limited
by Guarantee and a Registered Charity.
Registered in England No. 2155347 Registered Charity No. 800579
Registered office 12 Union Road, Cambridge CB2 1EZ.

It’s possible, but is more complicated. Can you describe why moving
ticket between queues doesn’t work for you?

The ticket would end up in the correct queue, but it generates some
unnecessary email in the process when the admin watchers of the original
queue are notified about the new ticket in their queue when it is
created, when in fact it isn’t meant for them, unless this can be
suppressed when the needed queue move is detected. Will a false return
from the custom action prep code prevent this? I guess I need to refer
to my RT Essentials book again, tomorrow morning since it is in my
office.

Also, the default queue change template is just a basic change
notification, so it doesn’t contain the original problem description. I
suppose with some extra logic, the original problem description could be
added to some (or maybe all) of the queue change notification emails.

I updated our queue change template to include the original content from
the ticket creation transaction, that part wasn’t too difficult. I even
got the create scrip to look at the message and identify what I need,
but I am having trouble duplicating what the built-in scrip does when it
executes the Notify AdminCc action.

I am trying to get the scrip to not notify anyone when the ticket is
automatically moved to a different queue, which is easy, but if the
ticket is not moved, it should notify the AdminCcs, just like normal.
What code in a Scrip will duplicate that default notify action?

~Jason

/------------------------------------------------------------------
| Jason A. Smith Email: smithj4@bnl.gov |
| Atlas Computing Facility, Bldg. 510M Phone: +1-631-344-4226 |
| Brookhaven National Lab, P.O. Box 5000 Fax: +1-631-344-7616 |
| Upton, NY 11973-5000, U.S.A. |
------------------------------------------------------------------/

smime.p7s (3.88 KB)

I am trying to get the scrip to not notify anyone when the ticket is
automatically moved to a different queue, which is easy, but if the
ticket is not moved, it should notify the AdminCcs, just like normal.
What code in a Scrip will duplicate that default notify action?

I tried looking through the RT code to see if I could duplicate the
built-in notify admincc action, and came up with this custom action prep
scrip:

my $ScripActionObj = $self->ScripActionObj;
$ScripActionObj->Load(‘Notify’, $self->TemplateObj->Id);
$ScripActionObj->SetExecModule(‘Notify’);
$ScripActionObj->SetArgument(‘AdminCc’);
$ScripActionObj->LoadAction(TransactionObj => $self->TransactionObj,
TicketObj => $self->TicketObj);
return($ScripActionObj->Prepare);

but it doesn’t work right. When I test it I get a message like this in
my RT logs:

RT: Scrip Commit 4 died. - Can’t call method “id” on an undefined value
at /usr/lib/perl5/vendor_perl/5.8.8/RT/Action/SendEmail.pm line 300.
Stack: …

Any ideas on what I am doing wrong and how I can get it to work
correctly?

Thanks,
~Jason

/------------------------------------------------------------------
| Jason A. Smith Email: smithj4@bnl.gov |
| Atlas Computing Facility, Bldg. 510M Phone: +1-631-344-4226 |
| Brookhaven National Lab, P.O. Box 5000 Fax: +1-631-344-7616 |
| Upton, NY 11973-5000, U.S.A. |
------------------------------------------------------------------/

smime.p7s (3.88 KB)

I am trying to get the scrip to not notify anyone when the ticket is
automatically moved to a different queue, which is easy, but if the
ticket is not moved, it should notify the AdminCcs, just like normal.
What code in a Scrip will duplicate that default notify action?

I tried looking through the RT code to see if I could duplicate the
built-in notify admincc action, and came up with this custom action prep
scrip:

my $ScripActionObj = $self->ScripActionObj;
$ScripActionObj->Load(‘Notify’, $self->TemplateObj->Id);
$ScripActionObj->SetExecModule(‘Notify’);
$ScripActionObj->SetArgument(‘AdminCc’);
$ScripActionObj->LoadAction(TransactionObj => $self->TransactionObj,
TicketObj => $self->TicketObj);
return($ScripActionObj->Prepare);

but it doesn’t work right.

Okay, I think I found my mistake. I was missing an argument when
calling LoadAction: ScripObj => $self->ScripObj

After adding that, it seems to work right. Is this the right way to
replicate the built-in “Notify AdminCcs” Action with your own custom
scrip action?

~Jason

/------------------------------------------------------------------
| Jason A. Smith Email: smithj4@bnl.gov |
| Atlas Computing Facility, Bldg. 510M Phone: +1-631-344-4226 |
| Brookhaven National Lab, P.O. Box 5000 Fax: +1-631-344-7616 |
| Upton, NY 11973-5000, U.S.A. |
------------------------------------------------------------------/

smime.p7s (3.88 KB)