[rt-users] Help with displaying Error message

Ken Crocker kfcrocker at lbl.gov
Wed Mar 18 16:08:08 EDT 2009


Ashish,


    That's a lot of code to add. I was hoping there was a simple command 
to use within a scrip that would issue or display an error message. 
However, I'll look this over and see if I can get it to work. Thanks.

Kenn
LBNL

On 3/18/2009 12:39 PM, Potla, Ashish Bassaliel wrote:
> Hi,
> I have this set up : 
>
> On local/html/Ticket/Modify.html 
>
> In the INIT Block :
>
> my %queues_custom = ('<name of your queue>' => '1');
> if ($queues_custom{$Ticket->QueueObj->Name}) {
>     my @custom_results = ProcessCustomRequiredUpdates(TicketObj => $Ticket);
>     push @results, at custom_results;
> }
>
> On local/lib/RT/Interface/Web.pm I have added :
>
> sub ProcessCustomRequiredUpdates {
>     my %args = @_;
>     my $TicketObj = $args{'TicketObj'};
>     my @results;
>     $RT::Logger->debug("Queue name is ".$Ticket->QueueObj->Name." Status is ".$Ticket->Status);
>     if ( $TicketObj && $TicketObj->QueueObj->Name =~ m/^(<REGULAR EXPR OF YOUR QUEUENAME>)$/ && $TicketObj->Status =~ m/^(resolved)$/) {
>         
>         my $ObjectCFs = RT::ObjectCustomFields->new($RT::SystemUser);
>         $ObjectCFs->LimitToObjectId($TicketObj->QueueObj->Id);
>         $ObjectCFs->LimitToLookupType('RT::Queue-RT::Ticket');
>                     
>         my @CustomFields = $ObjectCFs->CustomFields;
>         foreach my $CustomField (@CustomFields) {
>             next unless ($CustomField->Name =~ m/^(REGULAR EXPR OF YOUR CF)$/);
>             my $Values = $TicketObj->CustomFieldValues( $CustomField->Id );
>             unless ($Values->Count) {
>                 push @results, "Error: Custom Field ".$CustomField->Name." is required. Changing Status of ticket to new";
>                 $TicketObj->SetStatus('new');
>                 last;
>             }
>         }
>     }
>     return @results;
> }
>
> Note: The put the code in modify.html just after pushing the rest of the various results into @results. I put it after this block of code :
> push @results, @wresults;
> push @results, @dresults;
> push @results, @lresults;
> push @results, @cf_results;
>
> When inserting the new function into Web.pm, make sure to update the correct values(ie case as well) of REGULAR EXPR OF YOUR QUEUENAME and REGULAR EXPR OF YOUR CF
>
> I know that I have to put in the new function into Web_Local.pm but if I do it doesnt seem to work. May be you can test it out and let me know.
>
> Thanks
> -Ashish
> ________________________________________
> From: rt-users-bounces at lists.bestpractical.com [rt-users-bounces at lists.bestpractical.com] On Behalf Of Ken Crocker [kfcrocker at lbl.gov]
> Sent: Thursday, March 19, 2009 12:42 AM
> To: rt Users
> Subject: [rt-users] Help with displaying Error message
>
> To all,
>
>     I have a scrip thar re-sets the Ticket Status to "open" when a
> ticket  is resolved and a certain CF has no value. Making the CF
> Mandatory is not an option as the users do NOT know what to put in it
> when the ticket is created and we don't want the mandatory setting to
> stop ticket creation.
>     What I want to do is display a message on the "Modify Ticket" screen
> when they "resolve" the ticket and the CF has NOT been set. Everything
> else is working fine. Any help there? Thanks.
>
>
> Kenn
> LBNL
>
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
>
>   




More information about the rt-users mailing list