[rt-users] SetStatus and SetOwner scrip question
Ken Crocker
kfcrocker at lbl.gov
Fri Sep 25 12:19:04 EDT 2009
Mike,
You didn't get my code correct. You forgot the "Force". (NO, I'm NOT
saying "may the force be with you", gaagh!).
Also, when creating a scrip, you must keep in mind that when you define
the condition as :User-Defined", you SHOULD end with a return code in
both the "Prep" & "Cleanup" areas. Since my code is in the "Cleanup"
area, I have a "return 1;" in the "Prep" area. That way RT knows to
continue on to the cleanup area. So, to re-cap, your code should look
something like this:
Condition: On whatever
Action: User-Defined
Custom Prep Code:
Return 1;
Custom Cleanup Code:
# set new Ticket Owner value
my $ticket = $self->TicketObj;
$ticket->SetStatus('new');
$ticket->SetOwner(10, 'Force');
return 1;
That should do it. Hope this helps.
Kenn
LBNL
On 9/25/2009 6:55 AM, Mike Johnson wrote:
> Hi Kevin,
>
> Thx for that tidbit of info,
>
> In that file I found the correct syntax, out of Sean's set, the 2
> below will work,
>
> $self->TicketObj->SetOwner("Nobody");
> $self->TicketObj->SetOwner("10");
>
> But, this is baffling me...
>
> This is my scrip
>
> Condition: On Queue Change
> Action: User Defined
> Custom action Preparation Code:
> # set new Ticket Owner value
> my $ticket = $self->TicketObj;
> $ticket->SetStatus("new");
> $ticket->SetOwner("Nobody");
>
> Based on the above investigation, I know the syntax is correct for the
> SetOwner. However, the only thing that happens on queue change is the
> ticket's status is set to new. That shows up in the ticket history.
> The SetOwner doesn't show up at all, nothing happens.
>
> This is the exact same spot Sean got stuck.... and the thread ended.....
>
>
> Ken Crocker(thx Ken) provided the above code + 1 line (return 1;) and
> said his is in the cleanup code spot. If I put that code in there,
> absolutely nothing gets changed in the ticket...
>
> Any thoughts anyone?
>
>
>
>
>
> Mike Johnson
> Datatel Programmer/Analyst
> Northern Ontario School of Medicine
> 955 Oliver Road
> Thunder Bay, ON P7B 5E1
> Phone: 807.766.7331
> Email: mike.johnson at normed.ca <mailto:mike.johnson at normed.ca>
> Technology assistance: email nosmhelpdesk at normed.ca
> <mailto:nosmhelpdesk at normed.ca>
> Technology Emergency Contact (TEC) Mon-Fri, 8am to 5pm excluding stat
> holidays:
> Off campus toll free 1-800-461-8777, option 8, or locally either
> (705)-662-7120 or (807)-766-7500
>
>
> >>> Kevin Falcone <falcone at bestpractical.com> 24/09/2009 5:06 pm >>>
> On Thu, Sep 24, 2009 at 04:02:10PM -0400, Mike Johnson wrote:
> > I was looking through the list's history.
> >
> > The original email did not get an answer to it.
> >
> > The piece that interests me about this listserv topic(dating back
> to Aug 2007)....
> >
> >
> > Sean, and myself are trying to set a ticket's owner to nobody on
> an action...
> >
> > He stated,
> >
> > I've tried:
> >
> > $self->TicketObj->SetOwner("Nobody");
> > $self->TicketObj->SetOwner(Nobody);
> > $self->TicketObj->SetOwner("10");
> > $self->TicketObj->SetOwner(10);
> > $self->TicketObj->SetOwner(Name => "Nobody");
> > $self->TicketObj->SetOwner(Name => Nobody);
> > $self->TicketObj->SetOwner(Id => "10");
> > $self->TicketObj->SetOwner(Id => 10);
> >
> > None of these has worked and nothing in rt.log indicates any
> problems. I have
> > it set up with debug so I know I'm getting as much info as I can.
>
> If you want as much information as possible, you should check the
> return values of SetOwner. The arguments for the SetOwner method are
> documented in Ticket_Overlay.pm.
>
> -kevin
>
> > Can anyone tell me which of the above? and what else do I need to
> set to make this happen on a
> > specific condition(I'm using On Queue change).
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20090925/379712bf/attachment.htm>
More information about the rt-users
mailing list