Color ColumnMap with SLA Column

Hi All,
I am using the ShowStatusInColor extension and the SLA Extensions and
would like my tickets’ SLA fields to show up in color as well but I
cannot seem to get the query syntax correct in the ColorMap script. I
basically edited the Priority ColorMap but it cannot compile because I
can’t get the correct column name for my custom field. here is what I
have:
[snip]
89 # Set the SLA numbers to a colour.
90 sub SLAInColor {
91 my $Ticket = shift;
92
93 my $sla = $Ticket->CF.{SLA};
94 my $colors = undef;
95
96 # Change priority numbers to reflect your priority system.
97 if ($sla == ‘System Inoperable’) {
98 $colors = “#FF0000”;
99 } elsif ($sla == ‘Service Impaired’) {
100 $colors = “#FF2000”;
101 } elsif ($sla == ‘General Inquiry’) {
102 $colors = “#FF4000”;
103 }
104
105 if ($colors) {
106 $sla = "<div style=“color: $colors;”>$sla"
107 }
108
109 return “$sla”;
110 }
[snip]

the offending line is:
93 my $sla = $Ticket->CF.{SLA};

It doesn’t like the CF.{SLA} I have tried CustomField.{SLA}, CustomField
.{SLA}, CF.{SLA}, and SLA. It does not seem to like my \ which I
thought was a perfectly perlish way to escape a character…
The Field description name is SLA Priority, I have tried that as well.

TIA,
Steve

For strings use ‘eq’ instead of ‘==’, for example: if ( $x eq ‘some
string’ ) { …

To get value of a custom field of single type use
$ticket->FirstCustomFieldValue(‘SLA’);, CFs with multiple values need
more work.

CF.{SLA} is end user syntax and is not perl, so you can not use it in the code.On Mon, Feb 23, 2009 at 11:35 PM, Steve OBrien steve.obrien@hdesd.org wrote:

Hi All,
I am using the ShowStatusInColor extension and the SLA Extensions and
would like my tickets’ SLA fields to show up in color as well but I
cannot seem to get the query syntax correct in the ColorMap script. I
basically edited the Priority ColorMap but it cannot compile because I
can’t get the correct column name for my custom field. here is what I
have:
[snip]
89 # Set the SLA numbers to a colour.
90 sub SLAInColor {
91 my $Ticket = shift;
92
93 my $sla = $Ticket->CF.{SLA};
94 my $colors = undef;
95
96 # Change priority numbers to reflect your priority system.
97 if ($sla == ‘System Inoperable’) {
98 $colors = “#FF0000”;
99 } elsif ($sla == ‘Service Impaired’) {
100 $colors = “#FF2000”;
101 } elsif ($sla == ‘General Inquiry’) {
102 $colors = “#FF4000”;
103 }
104
105 if ($colors) {
106 $sla = “<div style="color: $colors;">$sla”
107 }
108
109 return "$sla";
110 }
[snip]

the offending line is:
93 my $sla = $Ticket->CF.{SLA};

It doesn’t like the CF.{SLA} I have tried CustomField.{SLA}, CustomField
.{SLA}, CF.{SLA}, and SLA. It does not seem to like my \ which I
thought was a perfectly perlish way to escape a character…
The Field description name is SLA Priority, I have tried that as well.

TIA,
Steve


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Best regards, Ruslan.