[rt-users] Action Upon Approval
Ben Blakely
bblakely at gmail.com
Mon Dec 13 15:38:49 EST 2004
Hey Todd,
It seems to be a problem with getting an action to be performed after
the child ( approval ticket ) is resolved. Im taking your approach,
when the approval ticket is resolved id like to have another ticket
created in another queue.
Ben
On Mon, 13 Dec 2004 14:33:22 -0500, Todd Chapman <rt at chaka.net> wrote:
> It's not fair unless everyone at home get to play along.
>
> So, one step at a time:
>
> Are you having a problem getting a scrip to run when a ticket
> is resolved? My approach below is to create the 2nd ticket
> when the first ticket is resolved, not before.
>
> -Todd
>
> On Mon, Dec 13, 2004 at 03:06:56PM -0500, Ben Blakely wrote:
> > Hey Todd,
> >
> > Thanks for the reply. Im new to the custom fields and fairly familiar
> > with the user defined script stuff. I did create a custom field, and
> > read the documentation relating to it, but still dont understand how
> > this custom field helps to create a child ticket on resolve. Do you
> > think you could explain a little more? Basically, what Im trying to
> > accomplish is having a ticket come into a certain queue, request
> > approval for it, and upon approval create a child ticket in another
> > queue.
> >
> > Ive figured out the Approval stuff and howto get a child created in
> > another queue, but cant seem to get RT to perform an action once its
> > been approved. I have even created scrips within those queue's that
> > perform an action on resolve ( RT seems to put tickets into a resolved
> > status once approved ), to no avail.
> >
> > I did create a script with the user defined information above and set
> > the stage to disabled. I also create a custom field named Resolve
> > Action for that queue, but tailing RT's logs indicate its not doing
> > anything on resolve. Any kind of help relating to my setup would be
> > muchly appreciated.
> >
> > Regards,
> >
> > Ben Blakely
> >
> > On Mon, 13 Dec 2004 13:11:49 -0500, Todd Chapman <rt at chaka.net> wrote:
> > > I create a custom field called 'Resolve Action' that creates a new
> > > ticket when the current ticket is resolved. This allows for
> > > very simple (2 steps) workflow. This scrip is kind of complicated
> > > because of other things we do, but I can share some snippets:
> > >
> > > Custom condition:
> > > my $trans = $self->TransactionObj->Type;
> > > if ($trans eq 'Status' && $self->TransactionObj->NewValue =~ /(resolved|rejected|deleted)/i) {
> > > return 1;
> > > }
> > >
> > > Custom action preparation code:
> > >
> > > 1;
> > >
> > > Custom action cleanup code:
> > >
> > > if ($status =~ /Resolved/i) {
> > >
> > > my $cfValues = $self->TicketObj->CustomFieldValues('Resolve Action');
> > > if ($cfValues->Count) {
> > > $RT::Logger->debug("Processing resolve actions: " . $cfValues->Count);
> > > # run resolve_action
> > > # for each action, create a ticket, set its parent to my parent
> > > # (assuming one parent)
> > > my @new_tickets;
> > > while (my $value = $cfValues->Next) {
> > > #$RT::Logger->debug("Resolve value: '$value'");
> > > my $ticket = new RT::Ticket($RT::SystemUser);
> > > #need to set Queue Requestor Cc AdminCc Type? Subject
> > > my ($reqtype,$AdminCc,$Cc) = split(/:/, $value->Content);
> > > my $type; #20
> > > if ($reqtype =~ /approval/i) { $type = 'approval'; }
> > > else { $type = 'ticket'; }
> > > my $content;
> > > if ($self->TicketObj->Transactions->First) {
> > > $content = MIME::Entity->build(Charset => 'utf8', Data => $self->TicketObj->Transactions->First->Content);
> > > }
> > > my %ticket_args = (
> > > Subject => $self->TicketObj->Subject,
> > > Queue => $self->TicketObj->QueueObj->Name,
> > > Requestor => $self->TicketObj->RequestorAddresses,
> > > Cc => $Cc,
> > > AdminCc => $AdminCc,
> > > Type => $type,
> > > MIMEObj => $content || undef,
> > > );
> > > if ($self->TicketObj->MemberOf->First) {
> > > $ticket_args{MemberOf} =
> > > $self->TicketObj->MemberOf->First->TargetObj->Id;
> > > }
> > > else {
> > > $ticket_args{MemberOf} = $self->TicketObj->Id;
> > > }
> > > #need to set custom field
> > > my $customfield = new RT::CustomField($RT::SystemUser);
> > > $customfield->LoadByNameAndQueue(Queue => $self->TicketObj->QueueObj->Name, Name => "Request Type");
> > > my $cfid = $customfield->Id;
> > > $ticket_args{"CustomField-$cfid"} = $value->Content;
> > > $RT::Logger->debug("Setting cf $cfid to: " . $value->Content);
> > > my ($id, undef, $msg) = $ticket->Create(%ticket_args);
> > > $RT::Logger->debug("Created ticket from resolve action: " . $id);
> > > $RT::Logger->debug("Ticket creation error: $msg") unless $id;
> > > next unless $id;
> > > push @new_tickets, $id;
> > > #then add comment for parent first and last? #50
> > > }
> > > unless (@new_tickets) {
> > > $RT::Logger->debug("No resolve actions successful for ticket: " . $self->TicketObj->Id);
> > > return 1;
> > > }
> > >
> > > On Mon, Dec 13, 2004 at 11:55:41AM -0500, Ben Blakely wrote:
> > > > Hello All,
> > > >
> > > > I have configured the Approvals within RT. I was wondering if anyone
> > > > has an idea on howto get an action to be performed after approval.
> > > >
> > > > For example, id like to create a child ticket within another queue
> > > > once the initial approval has been approved.
> > > >
> > > > Regards,
> > > >
> > > > Ben Blakely
> > > > _______________________________________________
> > > > http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> > > >
> > > > Be sure to check out the RT wiki at http://wiki.bestpractical.com
> > >
>
More information about the rt-users
mailing list