Labeled priorities]

[Let’s try again on the right list.]

As part of replacing our existing helpdesk whiteboard with RT, I need
to implement something like labeled priorities – so that instead of
setting a ticket to a priority of 90 with a final priority of 100, you
set it to “S1” and the priority and final priority get set
appropriately.

Before I set about inventing this wheel on my own, is anyone aware of
an existing way to pull off such a thing? At a minimum, I need a
pulldown to set priority in the “Basics” section; at best, the labels
would be used instead of the numbers everywhere.

-Rich

Rich Lafferty --------------±----------------------------------------------
Ottawa, Ontario, Canada | Save the Pacific Northwest Tree Octopus!
http://www.lafferty.ca/ | http://zapatopi.net/treeoctopus.html
rich@lafferty.ca -----------±----------------------------------------------

Don’t laugh, but if you want to avoid re-implementing the wheel, take a look
at keywords.

Keywords aren’t linked to priorities, but you get a supported pulldown in
the UI, and don’t have to tinker with the db schema. The task of synching
numeric priorities to the keyword label can be done by a crontab (for
prototyping purposes) or scrip (for final implementation).From: “Rich Lafferty” rich+rt@lafferty.ca
To: rt-devel@lists.fsck.com
Sent: Monday, February 11, 2002 12:39 PM
Subject: [rt-devel] Fwd: [rich+rt@lafferty.ca: [rt-users] Labeled
priorities]

[Let’s try again on the right list.]

As part of replacing our existing helpdesk whiteboard with RT, I need
to implement something like labeled priorities – so that instead of
setting a ticket to a priority of 90 with a final priority of 100, you
set it to “S1” and the priority and final priority get set
appropriately.

Before I set about inventing this wheel on my own, is anyone aware of
an existing way to pull off such a thing? At a minimum, I need a
pulldown to set priority in the “Basics” section; at best, the labels
would be used instead of the numbers everywhere.

-Rich


Rich
Lafferty --------------±----------------------------------------------
Ottawa, Ontario, Canada | Save the Pacific Northwest Tree Octopus!
http://www.lafferty.ca/ | http://zapatopi.net/treeoctopus.html

rich@lafferty.ca -----------±----------------------------------------------


rt-devel mailing list
rt-devel@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-devel

Don’t laugh, but if you want to avoid re-implementing the wheel, take a look
at keywords.

Keywords aren’t linked to priorities, but you get a supported pulldown in
the UI, and don’t have to tinker with the db schema. The task of synching
numeric priorities to the keyword label can be done by a crontab (for
prototyping purposes) or scrip (for final implementation).

Hrm…

Assuming that you’d like:

OnSetKeyword SetPriorityFromKeyword with template KeywordPriorities

then you’d need to insert_condition for OnSetKeyword to set
ApplicableTransTypes to ‘Keyword’ with ExecModule of AnyTransaction, then:

# SetPriorityFromKeyword.pm - RT ScripAction to set a priority based
# on keyword

package RT::Action::SetPriorityFromKeyword;
require RT::Action::Generic;
@ISA = qw(RT::Action::Generic);

sub Prepare {
	# nothing really to do here
	my $self=shift;

	my $retval = undef;

	if( $self->TransactionObj->Type =~ /Keyword/ ){
		# protect against people putting this action in
		# a weird place
		$retval = 1;
	}

	return($retval);
}

sub Commit {
	my $self=shift;

	my $retval=undef;
	# Get the template.
	my @tsplit = split(/\n/, $self->$TemplateObj->Content);
	my %easy_chk = ();
	foreach my $thisline( @tsplit ){
		# template is ':' seperated, with 'keyword:priority'
		next unless( $thisline =~ /^\s*(\S+)\s*:\s*(\d+)\s*$/ );
		$easy_chk{"$1"} = $2;
	}

	# What did we set?  We check the 'Newvalue' field of our
	# Transaction.
	my $tmpval = $self->TransactionObj->NewValue();

	if( defined( $easy_chk{"$tmpval"} ) ){
		$retval = $self->TicketObj->SetPriority( $easy_chk{"$tmpval"} );
	}

	return( $retval );
}

1;

The above is me rambling, and may or may not work for you. The template
should be a \n seperated list of ‘keyword : priority_to_set’.

Regards,

                         Bruce Campbell                            RIPE
               Systems/Network Engineer                             NCC
             www.ripe.net - PGP562C8B1B                      Operations
  if( defined( $easy_chk{"$tmpval"} ) ){
  	$retval = $self->TicketObj->SetPriority( $easy_chk{"$tmpval"} );
  }

Actually, thats an incredibly lazy way of checking the Keyword, as it
completely fails to take into account possible hierarchys which
conceivably should have higher priorities, and will easily get confused
with multiple sub-keywords that are named the same.

Nothing is as easy as it seems :wink:

                         Bruce Campbell                            RIPE
               Systems/Network Engineer                             NCC
             www.ripe.net - PGP562C8B1B                      Operations

Don’t laugh, but if you want to avoid re-implementing the wheel, take a look
at keywords.

Keywords aren’t linked to priorities, but you get a supported pulldown in
the UI, and don’t have to tinker with the db schema. The task of synching
numeric priorities to the keyword label can be done by a crontab (for
prototyping purposes) or scrip (for final implementation).

Hrm…

Assuming that you’d like:

OnSetKeyword SetPriorityFromKeyword with template KeywordPriorities

then you’d need to insert_condition for OnSetKeyword to set
ApplicableTransTypes to ‘Keyword’ with ExecModule of AnyTransaction, then:

SetPriorityFromKeyword.pm - RT ScripAction to set a priority based

on keyword

package RT::Action::SetPriorityFromKeyword;
require RT::Action::Generic;
@ISA = qw(RT::Action::Generic);

sub Prepare {
# nothing really to do here
my $self=shift;

  my $retval = undef;

  if( $self->TransactionObj->Type =~ /Keyword/ ){
  	# protect against people putting this action in
  	# a weird place
  	$retval = 1;
  }

  return($retval);

}

sub Commit {
my $self=shift;

  my $retval=undef;
  # Get the template.
  my @tsplit = split(/\n/, $self->$TemplateObj->Content);
  my %easy_chk = ();
  foreach my $thisline( @tsplit ){
  	# template is ':' seperated, with 'keyword:priority'
  	next unless( $thisline =~ /^\s*(\S+)\s*:\s*(\d+)\s*$/ );
  	$easy_chk{"$1"} = $2;
  }

  # What did we set?  We check the 'Newvalue' field of our
  # Transaction.
  my $tmpval = $self->TransactionObj->NewValue();

  if( defined( $easy_chk{"$tmpval"} ) ){
  	$retval = $self->TicketObj->SetPriority( $easy_chk{"$tmpval"} );
  }

  return( $retval );

}

1;

The above is me rambling, and may or may not work for you. The template
should be a \n seperated list of ‘keyword : priority_to_set’.

Regards,


Bruce Campbell RIPE
Systems/Network Engineer NCC
www.ripe.net - PGP562C8B1B Operations


rt-devel mailing list
rt-devel@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-devel

                         Bruce Campbell                            RIPE
               Systems/Network Engineer                             NCC
             www.ripe.net - PGP562C8B1B                      Operations