Callback to redirect page in Create.html

Hello,

Can anyone offer any insight about creating a Callback in Create.html to
redirect to a custom create page an a per queue basis? I believe I have the
correct callback in:

/opt/rt4/local/html/Callbacks/MYNAME/Ticket/Create.html/Init

and I am able to perform the redirect, but can’t seem to get the queue name
properly to test the queue name. I am thinking it would be something like

<%init>
%if ($Queueobj->Name eq ‘Whatever’){
$m->redirect(’/Tickets/custom.html’);
}
</%init>

the redirect portion works fine, I just don’t know how to get the queue
name. If anyone wants to offer up an end to end solution including an
example custom page that would be even better!

Thanks,
Jim

Jim,

I did it the following way in RT 4.0.5:

Copied share/html/Ticket/Create.html into the local/html/Ticket directory, changed the Init callback line in Create.html to make:

$m->callback( CallbackName => “Init”, ARGSRef => %ARGS, QueueObj => QueueObj );

Copied original Create.html into local directory and renamed original Create.html to another name (CreateNew.html).

In the callback you described (local/html/Callbacks/MYNAME/Ticket/Create.html/Init) I have:

<%init>
if ($Queueobj->Name eq ‘Custom Queue Name’){
$m->redirect($RT::WebURL.“Ticket/CreateNew.html?Queue=”.$QueueObj->id);
}
</%init>

<%ARGS>
$QueueObj => undef
</%ARGS>

The WebURL part is probably not needed, and I’m not sure what the ARGS section does, but I don’t want to change it now as it works. Apologies if there are any typos, I’m copying it across manually from another terminal.

Regards,
PaulFrom: rt-users-bounces@lists.bestpractical.com [rt-users-bounces@lists.bestpractical.com] on behalf of Jim Lesinski [jim.lesinski@gmail.com]
Sent: 11 June 2012 23:39
To: rt-users@lists.bestpractical.com
Subject: [rt-users] Callback to redirect page in Create.html

Hello,

Can anyone offer any insight about creating a Callback in Create.html to redirect to a custom create page an a per queue basis? I believe I have the correct callback in:

/opt/rt4/local/html/Callbacks/MYNAME/Ticket/Create.html/Init

and I am able to perform the redirect, but can’t seem to get the queue name properly to test the queue name. I am thinking it would be something like

<%init>
%if ($Queueobj->Name eq ‘Whatever’){
$m->redirect(‘/Tickets/custom.html’);
}
</%init>

the redirect portion works fine, I just don’t know how to get the queue name. If anyone wants to offer up an end to end solution including an example custom page that would be even better!

Thanks,
Jim

Think green - keep it on the screen.

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.

I had thought about doing that but it seemed like there would be some way
to access the queue from the ARGSRef. It’s good to know that is an option.

How are you handling custom field layout in your CreateNew.html then?
Ideally I would like to modify the layout of some custom fields or maybe
put them into their own section. It looks like the fields are all rendered
in /Ticket/Elements/EditCustomFields.

What is the best practice there?

Thanks,
JimOn Tue, Jun 12, 2012 at 3:29 AM, Renney, Paul paul.renney@logica.comwrote:

Jim,

I did it the following way in RT 4.0.5:

Copied share/html/Ticket/Create.html into the local/html/Ticket directory,
changed the Init callback line in Create.html to make:

$m->callback( CallbackName => “Init”, ARGSRef => %ARGS, QueueObj =>
QueueObj );

Copied original Create.html into local directory and renamed original
Create.html to another name (CreateNew.html).

In the callback you described
(local/html/Callbacks/MYNAME/Ticket/Create.html/Init) I have:

<%init>
if ($Queueobj->Name eq ‘Custom Queue Name’){
$m->redirect($RT::WebURL.“Ticket/CreateNew.html?Queue=”.$QueueObj->id);
}
</%init>

<%ARGS>
$QueueObj => undef
</%ARGS>

The WebURL part is probably not needed, and I’m not sure what the ARGS
section does, but I don’t want to change it now as it works. Apologies if
there are any typos, I’m copying it across manually from another terminal.

Regards,
Paul


From: rt-users-bounces@lists.bestpractical.com [
rt-users-bounces@lists.bestpractical.com] on behalf of Jim Lesinski [
jim.lesinski@gmail.com]
Sent: 11 June 2012 23:39
To: rt-users@lists.bestpractical.com
Subject: [rt-users] Callback to redirect page in Create.html

Hello,

Can anyone offer any insight about creating a Callback in Create.html to
redirect to a custom create page an a per queue basis? I believe I have the
correct callback in:

/opt/rt4/local/html/Callbacks/MYNAME/Ticket/Create.html/Init

and I am able to perform the redirect, but can’t seem to get the queue
name properly to test the queue name. I am thinking it would be something
like

<%init>
%if ($Queueobj->Name eq ‘Whatever’){
$m->redirect(‘/Tickets/custom.html’);
}
</%init>

the redirect portion works fine, I just don’t know how to get the queue
name. If anyone wants to offer up an end to end solution including an
example custom page that would be even better!

Thanks,
Jim

Think green - keep it on the screen. This e-mail and any attachment is for
authorised use by the intended recipient(s) only. It may contain
proprietary material, confidential information and/or be subject to legal
privilege. It should not be copied, disclosed to, retained or used by, any
other party. If you are not an intended recipient then please promptly
delete this e-mail and any attachment and all copies and inform the sender.
Thank you.

I had thought about doing that but it seemed like there would be some
way to access the queue from the ARGSRef. It’s good to know that is an
option.

Of course you can access the queue via the values in $ARGSRef. Look at
how the Ticket/Create.html page does it right below the Init callback line.

I see the line:
my $Queue = $ARGS{Queue};

but honestly I can’t seem to figure out how to get it to work in the Init
file. Could you show a simple example of it’s use?On Tue, Jun 12, 2012 at 11:36 AM, Thomas Sibley trs@bestpractical.comwrote:

On 06/12/2012 11:27 AM, Jim Lesinski wrote:

I had thought about doing that but it seemed like there would be some
way to access the queue from the ARGSRef. It’s good to know that is an
option.

Of course you can access the queue via the values in $ARGSRef. Look at
how the Ticket/Create.html page does it right below the Init callback line.

And here is what I ended up figuring out… Maybe that will even help you
Paul so you don’t have to have a local Create.html

<%init>

my $ARGSRef = $ARGS{‘ARGSRef’};

my $QueueObj = new RT::Queue($session{‘CurrentUser’});
$QueueObj->Load($ARGSRef->{‘Queue’});

if($QueueObj->Name eq ‘WhateverQueue’)
{
$m->redirect(‘/Tickets/MyCustomPage.html’);
}
</%init>
<%ARGS>
</%ARGS>On Tue, Jun 12, 2012 at 2:07 PM, Jim Lesinski jim.lesinski@gmail.comwrote:

I see the line:
my $Queue = $ARGS{Queue};

but honestly I can’t seem to figure out how to get it to work in the Init
file. Could you show a simple example of it’s use?

On Tue, Jun 12, 2012 at 11:36 AM, Thomas Sibley trs@bestpractical.comwrote:

On 06/12/2012 11:27 AM, Jim Lesinski wrote:

I had thought about doing that but it seemed like there would be some
way to access the queue from the ARGSRef. It’s good to know that is an
option.

Of course you can access the queue via the values in $ARGSRef. Look at
how the Ticket/Create.html page does it right below the Init callback
line.