Mailing List Archive

Adding field to modify TicketObj priority with AfterOwner callback
Hi All,

We're running RT 3.8.7 presently. I'm basically trying to add a field to the new ticket creation UI, so that the priority on new tickets can be set immediately, rather than having to create -> go to basics -> set priority.

The AfterOwner callback gives most agreeable positioning on the creation UI, so that's the callback I've gone with. However, looking at the callback definition in Ticket/Create.html, it looks like the TicketObj is not passed into this particular callback:

</td>
% $m->callback( CallbackName => 'AfterOwner', ARGSRef => \%ARGS );
</tr>

I could modify the call to pass the ticket, I suppose, but the whole point of using the callback is to avoid modifying the core code. So I'd rather not!

The following is what I have so far, can anyone advise how I might be able to modify my callback code to set the priority on the ticket that is being created:

Thanks!

<%INIT>
my $ArgsRef = $ARGS{'ARGSRef'};
my $priority = $ArgsRef->{'Priority'};
my $queueObj = new RT::Queue($session{'CurrentUser'});
$queueObj->Load($ArgsRef->{'Queue'});
RT::Logger->info("RT10205: Entering AfterOwner callback");
RT::Logger->info("RT10205: Priority: " . $priority);
RT::Logger->info("RT10205: Queue: " . $queueObj->Name);
if ($priority == 0)
{
RT::Logger->info("RT10205: Priority is 0, setting to: " . $queueObj->InitialPriority);
$priority = $queueObj->InitialPriority;
}
</%INIT>
<%ARGS>
</%ARGS>
<td class="label">
<&|/l&>Priority</&>:
</td>
<td class="value">
<input name="Priority" size="3" maxsize="3" value="<%$priority%>" />
</td>

Rhys Hanrahan
Chief Information Officer
Nexus One Pty Ltd

E: support@nexusone.com.au<mailto:support@nexusone.com.au>
P: +61 2 9191 0606
W: http://www.nexusone.com.au/
M: PO Box 127, Royal Exchange NSW 1225
A: 60 Justin Street, Lilyfield, NSW, 2040

[cid:AC695111-1B5F-45C1-B097-6093A0880284]
Re: Adding field to modify TicketObj priority with AfterOwner callback [ In reply to ]
On Tue, Jan 14, 2014 at 10:25:02PM +0000, Rhys Hanrahan wrote:
> The AfterOwner callback gives most agreeable positioning on the creation UI, so that's the
> callback I've gone with. However, looking at the callback definition in Ticket/Create.html, it
> looks like the TicketObj is not passed into this particular callback:

Priority is actually already available during ticket creation if you
click on Details in the upper right.

As for why your callback doesn't work, you're creating the ticket. At
the time AfterOwner is called, the ticket does not exist yet, so it
can't pass you anything.

You use AfterOwner to show your priority widget and then use another
callback to actually update the ticket.

I'd probably use BeforeCreate to push Priority into the ARGSRef so
that it seamless is used during creation, rather than coming as a
later transaction.

If you don't want to do that, read the bottom of Create.html's INIT,
you'll see that it passes execution to Display.html, so you'll use a
callback in there (or even easier, write a Scrip to do it On Create,
then it happens for tickets that come in via email in addition to the
web UI).

-kevin
Re: Adding field to modify TicketObj priority with AfterOwner callback [ In reply to ]
Bonjour,

Veuillez prendre note que je ne suis plus a l'emploi de IP4B Telecom (anciennement NovaVision Telecom) votre demande a ete achemine automatiquement a l'equipe de support technique qui se fera un plaisir de traiter votre requete dans les plus bref delai. Pour toute demande future il serait preferable d'ajuster vos contacts et d'acheminer vos futures requetes a support.ti@ip4b.ca

Merci et au plaisir.

Etienne Blain.

Hi,

Please take note that I'm no longer with IP4B Telecom (know before as NovaVision Telecom) your email was automatically redirected to the technical support staff and it will be a pleasure for them to answer you promptly. For future communication or request please send them to support.ti@ip4b.ca and update your contact list accordingly.

Thank you.

Etienne Blain.
Re: Adding field to modify TicketObj priority with AfterOwner callback [ In reply to ]
Thanks Kevin! Can you believe that after 4 years of using RT, none of us have actually pulled up the "show details" UI. Amazing.

Since "show details" doesn't require a page re-load, it could well suit our needs (quickly changing priority). But if that's still not enough and I need the extra field anyway, then I'll probably use ARGSRef on BeforeCreate as you suggested.

Very much appreciate your insight.

Thanks,
Rhys.

-----Original Message-----
From: rt-devel-bounces@lists.bestpractical.com [mailto:rt-devel-bounces@lists.bestpractical.com] On Behalf Of Kevin Falcone
Sent: Thursday, 16 January 2014 3:12
To: rt-devel@lists.bestpractical.com
Subject: Re: [rt-devel] Adding field to modify TicketObj priority with AfterOwner callback

On Tue, Jan 14, 2014 at 10:25:02PM +0000, Rhys Hanrahan wrote:
> The AfterOwner callback gives most agreeable positioning on the creation UI, so that's the
> callback I've gone with. However, looking at the callback definition in Ticket/Create.html, it
> looks like the TicketObj is not passed into this particular callback:

Priority is actually already available during ticket creation if you click on Details in the upper right.

As for why your callback doesn't work, you're creating the ticket. At the time AfterOwner is called, the ticket does not exist yet, so it can't pass you anything.

You use AfterOwner to show your priority widget and then use another callback to actually update the ticket.

I'd probably use BeforeCreate to push Priority into the ARGSRef so that it seamless is used during creation, rather than coming as a later transaction.

If you don't want to do that, read the bottom of Create.html's INIT, you'll see that it passes execution to Display.html, so you'll use a callback in there (or even easier, write a Scrip to do it On Create, then it happens for tickets that come in via email in addition to the web UI).

-kevin