How To Filter The Assign To Grids in Service Desk Express

A post in the MagicSolutions forum posed a challenge that I thought would be fun to try and solve, namely how to filter the Assign To grids in Service Desk Express. Unlike other popups that are accessed from a popup icon on the form these popups are accessed by clicking on the Assign To menu item. As such there is no out of the box facility within the application to filter this list as there is with other popups (see How to dynamically filter a popup list in Service Desk Express).

Solution

This is an unsupported hack of the ASP.NET code

The first thing to do is determine how you want to filter the popup as there is usually little point hardcoding something if it can be dynamic. For my example, I created a new field in the Support Staff module called Hide In Popups as shown below:

Hide In Popups

Now this field will be granted a unique number by Service Desk Express and it is important that you find out what this number is using the SQL statement below:

SELECT COLSEQ FROM dbo.SMSYSBASEVIEWDATA WHERE TBLSEQ = 18 AND VIEWCOLNAME = 'Hide In Popups'

In my case this returned a value of 1001.

To filter the popup we need to add some code in assignto_grid.aspx (located in C:Program FilesBMCService Desk ExpressApplication Server by default) just before the opening <HTML> tag:

<%
if (ViewName == "18" && sMode == "STAFF")
{
AddWhereClause += " + ||1001|| = 0";
}
else if (ViewName == "18" && sMode == "MYGROUP")
{
AddWhereClause += " AND ||1001|| = 0";
}
%>

Save the file and you should be good to go.

So how does this code work. Well the ViewName == “18” bit means that I only want to filter the Support Staff not the Groups (which incidentally would be ViewName == “13”). The sMode bit refers to which menu item this popup was called from e.g. Member of My Groups. The AddWhereClause bit simply says check if field 1001 (my new Hide in Popups field) is equal to 0. As to why the syntax is different for the two modes – PASS!

Summary

Anyway, seems to work. As always any feedback (positive or negative) is always welcome.

Advertisements

8 thoughts on “How To Filter The Assign To Grids in Service Desk Express

  1. Hello Alan,

    Thanks for this solution. I am looking for something simular: I need to filter groups and staff in the popup based on for example the company of the logged on SDE user. This is needed to prevent SDE users to assign incidents to any group in the database. I will use your example to develop this modification. If you have any advise regarding my case please let me know. Keep up the great work!

    Regards,

    Sander

  2. Hello Alan,

    I choose for an other approach, because I couldn’t get it working according your example. This is how I solved the issue: I added a company field to the staff and group records and used filtering in for example the group field of an incident form to only show the groups of a specific company of the selected client. Unfortunatly I had to disable some standard assignment functionality in the menu, but in my workflow (assignement on group level and not on specialist) this is not an issue. I my scenario (multiple small IT organizations by making use of data segregation in one BMC SDE environment) this is as far as I can see the easiest/fastest solution.

  3. Been seaching for this for a while and finally someone documented this. Thanks!
    Works great for Staff as well as Groups. Maybe I’m doing something wrong, but the top grid of ‘MYGROUP’ assignment doesn’t seem to filter…

  4. Hi Otto,

    Have you tried looking at the SQL being passed to the database using SQL Profiler as this might give some clues.

    Also, it might be worth altering the syntax to AddWhereClause += ” + ||1001|| = 0″; instead of AddWhereClause += ” AND ||1001|| = 0″;

    An issue I have with all my posts is that I don’t have examples of every SDE version/patch combination so it is possible that it doesn’t work with your version.

    Sorry if this doesn’t help much…

    Regards,

    Alan

  5. No worries. The groups marked not to be shown for assignments will only be shown via ‘members of my groups’ for people who are in these groups anyway. These are some ‘superusers’ that should be aware of the consequences of ‘misassignments’. The groups being hidden are the administrative groups (also the administrative users are hidden from assignment).
    PS: the sequences are retrieved from memberdata with the sequence of the user logged on (as far as I can see without addwhereclause possibilities).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s