[rt-users] Scrip help please.

Kenneth Crocker kfcrocker at lbl.gov
Thu Jun 10 17:03:15 EDT 2010


Paul,

I may be wrong, but I think the reason is that when a ticket is being
created, I don't believe that the "Ticket Custom Field: is available at the
time of "Custom Condition". I think you will have to add the code that
checks on the value of the Ticket Custom Field in one of the Custom Action
sections along with your code to add the Cc's. That also may be why the
example has an "or" in that code. Hope this helps.

Kenn
LBNL

On Thu, Jun 10, 2010 at 1:53 PM, Dougherty Paul <paul_dougherty at prn.com>wrote:

>  Hi Keith,
>
>
>
> First off, thanks for your help.
>
>
>
> This is what I am trying to implement…
> http://wiki.bestpractical.com/view/AddWatcherPerTicket
>
>
>
> I want this to fire when tickets are created and when the custom field of
> Urgency (already created and gets poplutated) is critical.
>
>
>
> This is from the wiki…
>
> return undef unless ( ($self->TransactionObj->Type eq "Create") ||
>
>                      ( $self->TicketObj->FirstCustomFieldValue('Urgency')
> eq "High"));
>
> return 1;
>
>
>
> So what I am trying to do is change the or statement to an and with && and
> change the High to Critical….but somehow this fails. I have tried every
> combination I can think of….
>
>
>
> Interestingly, I can get the first part (create) to fire correctly when it
> is by itself. I cannot get the Urgency part to ever evaluate as true.
>
>
>
> Cheers,
>
>
>
> Paul
>
>
>
> *From:* rt-users-bounces at lists.bestpractical.com [mailto:
> rt-users-bounces at lists.bestpractical.com] *On Behalf Of *Kenneth Crocker
> *Sent:* Thursday, June 10, 2010 1:40 PM
>
> *To:* rt-users at lists.bestpractical.com
> *Subject:* Re: [rt-users] Scrip help please.
>
>
>
> Paul,
>
> Perhaps I misunderstood. Are you wanting to meet these conditions at the
> same time (ie. a create with a CF) or are these to be two separate
> conditions exclusive of each other?
>
> Kenn
> LBNL
>
> On Wed, Jun 9, 2010 at 3:37 PM, Dougherty Paul <paul_dougherty at prn.com>
> wrote:
>
> Hi Keith,
>
>
>
> These did not help…I have gotten closer to the error, however.
>
>
>
> It seems rather stupid, all I am trying to do is to get the condition to
> ring true in my scrip.
>
>
>
> This is what I have.
>
>
>
> ($self->TicketObj->FirstCustomFieldValue('Urgency') eq "Critical");
>
>
>
>
>
> There are no errors generated by this scrip…but it doesn’t add the
> watchers…(this part works when the above condition is met). For example, if
> I simply use this…($self->TransactionObj->Type eq "Create"); in the
> condition, the scrip adds the watchers.
>
>
>
> Watcher add code:
>
> $self->TicketObj->AddWatcher( Type => "Cc",
>
>                               Email =>"paul_dougherty\@prn.com");
>
> push( @{$self->{'To'}},
>
>       $self->TicketObj->Requestors->MemberEmailAddresses,
>
>       $self->TicketObj->QueueObj->Cc->MemberEmailAddresses );
>
> return 1;
>
>
>
> Any ideas?
>
>
>
> Thanks,
>
>
> Paul
>
>
>
> *From:* Kenneth Crocker [mailto:kfcrocker at lbl.gov]
> *Sent:* Thursday, June 03, 2010 9:00 AM
> *To:* Dougherty Paul
>
>
> *Subject:* Re: [rt-users] Scrip help please.
>
>
>
> Paul,
>
> I have attached two txt files that have the code in them. These files have
> flower box comments and such that I always use to maintain my code. have fun
> with them.
>
> Kenn
> LBNL
>
> On Thu, Jun 3, 2010 at 8:27 AM, Dougherty Paul <paul_dougherty at prn.com>
> wrote:
>
> Hi Ken,
>
>
>
> Sure, I might be able to use those.
>
>
>
> Thanks,
>
>
>
> Paul
>
>
>
> *From:* rt-users-bounces at lists.bestpractical.com [mailto:
> rt-users-bounces at lists.bestpractical.com] *On Behalf Of *Kenneth Crocker
> *Sent:* Wednesday, June 02, 2010 5:07 PM
> *To:* rt-users at lists.bestpractical.com
> *Subject:* Re: [rt-users] Scrip help please.
>
>
>
> Paul,
>
> I have some code that adds a CC to an individual ticket on a Queue basis.
> So, if you want this for just certain types of tickets, maybe you could
> modify it for those conditions and put it in the Queues relevant to that
> need. OH, I also have some code that add's *additional* Cc's on
> "Correspondence" with those tickets as well. Is that something you might be
> interested in using?
>
> Kenn
> LBNL
>
> On Wed, Jun 2, 2010 at 2:50 PM, Dougherty Paul <paul_dougherty at prn.com>
> wrote:
>
> Hi,
>
>
>
> I am sure this is an id10t error, but I am trying to write a scrip that
> sends an adds a “CC” to a new ticket whose urgency is Critical (or
> critical). So far, the closest I have gotten is to have the system add the
> “CC”’s for every new ticket.
>
>
>
> Here is the custom condition that is giving me the fits. The current error
> I am receiving involves a syntax error…thing is, no matter what I try, I
> cannot get this thing to work. Every other part of this process works (ie,
> when the cc’s are added, the email is sent. The custom action does indeed
> add the cc’s).
>
>
>
> I just need to meet three conditions. One is on create, the other is
> Urgency (custom field) Critical or Urgency critical.
>
>
>
> Thanks,
>
>
> Paul
>
>
>
>
>
> Custom condition:
>
> if ( ($self->TransactionObj->Type eq "Create") &&
>
>                     ( ( $self->TicketObj->FirstCustomFieldValue('Urgency')
> eq "Critical") || ( $self->TicketObj->FirstCustomFieldValue('Urgency') eq
> "critical")))
>
> return 1;
>
> else
>
> return 0;
>
>
>
> Custom action: (runs fine):
>
> $self->TicketObj->AddWatcher( Type => "Cc",
>
>                               Email =>"xxx\@prn.com");
>
> $self->TicketObj->AddWatcher( Type => "Cc",
>
>                               Email =>"xxx\@prn.com");
>
> push( @{$self->{'To'}},
>
>       $self->TicketObj->Requestors->MemberEmailAddresses,
>
>       $self->TicketObj->QueueObj->Cc->MemberEmailAddresses );
>
> return 1;
>
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
>
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20100610/144af765/attachment.htm>


More information about the rt-users mailing list