[rt-users] Callbacks
Daniel Garcia Mejia
dgarcia at cesca.cat
Thu Jan 26 12:44:23 EST 2012
Hi,
I'm using RT 4.04.
I want to make a callback on top of the page that if a CF is empty when
I resolve one ticket....
I search in rt-users and I found this one user that do this:
Part 1: "Modify.html/Default" callback (user submitted a form from
The Basics)
<%INIT>
# Modify.html/Default
my $ARGSRef = $ARGS{'ARGSRef'};
# Bail if a resolve operation is not being tried.
my $Status = $$ARGSRef{'Status'};
if ($Status !~ /resolved/) {
return 1;
}
my $ticket = LoadTicket($$ARGSRef{'id'});
my $CustomFields = $ticket->QueueObj->TicketCustomFields();
while (my $CustomField = $CustomFields->Next()) {
my $nam = $CustomField->Name;
my $val = $ticket->FirstCustomFieldValue($nam);
if (($nam =~ /SomeRequiredField/i) and ($val =~ /^\s*$/)) {
Abort("ERROR: SomeRequiredField must be set to allow resolving.
Please use your browser's 'Back' button to correct this issue as
desired.");
}
}
return 1;
</%INIT>
<%ARGS>
</%ARGS>
======================================================================
Part 2: "Update.html/Initial" callback. User clicked "Resolve"
hyperlink on a ticket (upper right).
<%INIT>
my $ARGSRef = $ARGS{'ARGSRef'};
# Bail if a resolve operation is not being tried.
my $DefaultStatus = $$ARGSRef{'DefaultStatus'};
if ($DefaultStatus !~ /resolved/) {
return 1;
}
my $ticket = LoadTicket($$ARGSRef{'id'});
my $CustomFields = $ticket->QueueObj->TicketCustomFields();
while (my $CustomField = $CustomFields->Next()) {
my $nam = $CustomField->Name;
my $val = $ticket->FirstCustomFieldValue($nam);
if (($nam =~ /SomeRequiredField/i) and ($val =~ /^\s*$/)) {
Abort("ERROR: SomeRequiredField must be set to allow resolving.
Please use your browser's 'Back' button to correct this issue as
desired."); }
}
return 1;
</%INIT>
<%ARGS>
</%ARGS>
I can't understand how I can put this in RT , I suppose that the above
code is written for RT 3 and not for RT4 because I don't find 'Initial'
or 'Default'.
Any ideas that how I can implement or where exactly I have to put the
above code to make me a callback with a message if there are any CF
empty on resolve?
THANKS!
--
.......................................................................
__
/ / Daniel García Mejía
C E / S / C A Portals i Repositoris
/_/ Centre de Serveis Científics i Acadèmics de Catalunya
Gran Capità, 2-4 (Edifici Nexus) - 08034 Barcelona
T. (NULL) - F. 93 205 6979 - dgarcia at cesca.cat
.......................................................................
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20120126/4b920b00/attachment.htm>
More information about the rt-users
mailing list