[rt-users] Add queue change to Update.html (comment/reply)

Bart bart at pleh.info
Mon Feb 13 06:34:40 EST 2012


Hi,

I've been trying to create a callback for adding the Queue change field to
tue comment/reply page. (update.html)

In order to do so I've been using the existing Extension
"RT::Extension::CustomFieldsOnUpdate" as an example.
Initially to add the Queue field to this extension and to see if it will
eventually work.

Location of the callback files, as far as I could judge this is the only
location where I would need to edit the files:

/opt/rt4/local/plugins/RT-Extension-CustomFieldsOnUpdate/html/Callbacks/CustomFieldsOnUpdate/Ticket/Update.html
>

The first file I've edited was the tile AfterWorked, the bold part is the
thing I've added:

*<& /Elements/SelectQueue,
>     TicketObj => $Ticket,
>     InTable => 1,
>     DefaultsFromTopArguments => 0,
> &>*
> <& /Ticket/Elements/EditCustomFields,
>     TicketObj => $Ticket,
>     InTable => 1,
>     DefaultsFromTopArguments => 0,
> &>
> <%ARGS>
> $Ticket
> </%ARGS>
>

This alone adds the Queue field to the Update.html page. But it doesn't
show the current value + when changing the value it doesn't apply this to
the ticket.
So I figured I needed to change the second file, BeforeUpdate, as well. But
this is where I'm stuck, I don't really have an idea on what to add/how to
add the SelectQueue part to this file. Below the current contents:

<%ARGS>
> $TicketObj
> $skip_update
> $results
> $ARGSRef => {}
> </%ARGS>
> <%INIT>
> return unless $ARGSRef->{'SubmitTicket'};
>
> my $CFs = $TicketObj->CustomFields;
> my $ValidCFs = $m->comp(
>     '/Elements/ValidateCustomFields',
>     CustomFields => $CFs,
>     NamePrefix => "Object-RT::Ticket-". $TicketObj->id ."-CustomField-",
>     ARGSRef => $ARGSRef
> );
> unless ( $ValidCFs ) {
>     $$skip_update = 1;
>     while (my $CF = $CFs->Next) {
>         my $msg = $m->notes('InvalidField-' . $CF->Id) or next;
>         push @$results, loc($CF->Name) . ': ' . $msg;
>     }
> }
> </%INIT>
>

I take it that I need to make sure that it sets the Queue value and
something like that but compared to the CF code I don't really see how I
should add the Queue in this.
I've tried copying the above CF value, but I can't seem to get it to work
(keep getting syntax errors). Basically I'm lost in translation on this one
O_o

My goal is to eventually create a specific callback for this, thus not
editing the CustomFieldsOnUpdate extension.
Could someone with a little more experience with Callbacks shed some light
on this? I would expect this to be dead simple, I just don't yet have a
good grasp on the syntax and the works.

Thanks in advance.

-- Bart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20120213/e06d0dbf/attachment.htm>


More information about the rt-users mailing list