Dynamic Colors in the WorkitemView Console

Dynamic Colors in the WorkitemView Console
PeeGee's picture

Out of the box, Helpdesk Solution does not provide any possibility to highlight incidents which have a high priority or a specific status.

In the KB you can find the following article: https://kb.altiris.com/article.asp?article=34253&p... Which deals with color coding the Incident Grid, which is already a big help. But on the day to day basis it also handy to find the same highlight colors, when looking at a single incident.

The code of this article shows, how the background color of the "Priority" field can be changed, depending on the priority. Of course this can be used for any other field as well.

Compared to the JavaScript approach of the above KB article, I simply use duplicate priority fields (one per priority) but only show the priority field which reflects the priority of the current incident I am looking at.

As the other priority fields are automatically hidden, there is no shifting of the label orders.

For the next part I assume, that a custom worker console has been created and that a re-direction of the workitemview.aspx file to a custom location has already been configured.

How to do it

  1. In the custom worker console edit the file workitemview.ascx
  2. Find the line which starts with <aw:Label id="lblPriority" runat="server" ...
  3. Replace the entire code in the line with the following code:
    <aw:Label id="lblPriorityasap" runat="server" style="background-color:red" ItemDataField="workitem_priority_lookup_value" label="sidLblPriority" Visible='<%# DataStore("WorkItem").current.workitem_priority_lookup_id = "100" %>'></aw:Label>
    <aw:Label id="lblPriorityhigh" runat="server" style="background-color:red" ItemDataField="workitem_priority_lookup_value" label="sidLblPriority" Visible='<%# DataStore("WorkItem").current.workitem_priority_lookup_id = "200" %>'></aw:Label>
    <aw:Label id="lblPrioritymedium" runat="server" style="background-color:#addfff" ItemDataField="workitem_priority_lookup_value" label="sidLblPriority" Visible='<%# DataStore("WorkItem").current.workitem_priority_lookup_id = "300" %>'></aw:Label>
    <aw:Label id="lblPrioritylow" runat="server" style="background-color:#cfecec" ItemDataField="workitem_priority_lookup_value" label="sidLblPriority" Visible='<%# DataStore("WorkItem").current.workitem_priority_lookup_id = "400" %>'></aw:Label>
    <aw:Label id="lblPriorityplanned" runat="server" style="background-color:#cfecec" ItemDataField="workitem_priority_lookup_value" label="sidLblPriority" Visible='<%# DataStore("WorkItem").current.workitem_priority_lookup_id = "500" %>'></aw:Label>
    
    
  4. Save the changes to the file and re-load the WorkitemView Page.

Now the priority field should have a background color, depending on the status of the priority. Feel free to adjust the colors via the background-color: tag.

The below screenshot also shows the similar trick for the status field.

3.5625
Average: 3.6 (16 votes)

Nice and a question

johnquinn's picture

I like this a lot. I use the color in the grid currently and I like the idea of bringing the same scheme over while looking at an individual incident.

One quick question though for I'm new to scripting. With some of the darker colors, when you apply this the text is not very visible.

What would you add to this line to make the text itself stand out? I've tried entering in the style section things like text:white and color:white but they have no effect.

check your syntax

PeeGee's picture

Hi johnquinn,

you actually got the answer already. You need to set the "color" tag, just make sure that you get the syntax right. Inside the style tag, you need to separate different style settings with a ";".

So it should look like this:
"...style="background-color:black; color:red"

That did it

johnquinn's picture

PeeGee, that was it. When I was first trying it, I was simply using a space in the style. By putting the semi-colom in between, using color:white set the text to white so it stands out.

Thanks for the help.

Any idea how to make the

Any idea how to make the words 'category' , 'status' , 'Assigned' etc.... stand out in bold.

I know i need to start with [B] and end with [/B] but cant seem to get it in the right place....

Edit the CSS file

PeeGee's picture

The label tags configuration is defined in the styles.css file which can be found in \AEXHD\css
Find the section .clslabel and modify FONT-WEIGHT:
to read
FONT-WEIGHT: bold;

Save your .css file and you are done.

Of course you should not edit it directly in the css folder, as you'll lose this change on upgrade or repair, so make sure that you add the styles.css file into your custom.config file and direct it to a custom location of the modified version.

Thanks Peegee,If i make

Thanks Peegee,

If i make the change directly to the styles.css file, the results are perfect.
Could you please advise where i'm going wrong in naming the custom file?

I already have a custom.config file.
In here i've added a line which says

file id="Styles" file="CustomStyles.css"

And then i've copied the original styles.css file to my Custom folder and made the change to the .clslabel section.

I've restarted IIS, but the changes dont reflect. I'm assuming the error lies in my Customstyles.css file?

The file id should be

PeeGee's picture

The file id should be "stylescss"

Nice Job - Quick Question

In reference to the article of adding colors to the workitemgrid view Color coding the Helpdesk incident grids Does any one know how to grab the information in the cell and pass it to a variable? I am trying to grab the Modified Date and then compare it to the date now using the "DiffDate" function for VBscript. "nCol+2" is over two positions from the present column which would be the Modified Date column.

I tried the following:

Dim dt as Integer
Dim CurrentDate as Date = Now

ModifyDate = "" & grid & ".Cell(0, nRow, nCol+2)"
dt = DateDiff("n" , ModifyDate, CurrentDate)

but I recieve the following as the error:

Exception - System.InvalidCastException: Cast from string "_ctl0__ctl39__ctl0__ctl1_wgWorkI" to type 'Date' is not valid.
at Microsoft.VisualBasic.CompilerServices.DateType.FromString(String Value, CultureInfo culture)
at Microsoft.VisualBasic.CompilerServices.DateType.FromString(String Value)
at ASP.subWorkItemTable_ascx.FinalizeTemplate()
at Altiris.AppWeaver.TemplateControl.OnPreRender(EventArgs e)