[rt-devel] Adding field to modify TicketObj priority with AfterOwner callback

Rhys Hanrahan rhys at nexusone.com.au
Tue Jan 14 17:25:02 EST 2014


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 at nexusone.com.au<mailto:support at 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]


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-devel/attachments/20140114/d407b284/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 7083 bytes
Desc: image001.png
URL: <http://lists.bestpractical.com/pipermail/rt-devel/attachments/20140114/d407b284/attachment.png>


More information about the rt-devel mailing list