Modifying Queue Views in CRM
I was recently asked to change the queue views for a client. At first I thought, "hey, wait a tic... that's just a normal view that any old CRM customizer can modify, right?" And went directly to the customizations... No luck.
Apparently, they don't want you to be able to change the queue views. Queues are not customizable entities. So, I went into the actual page in the CRM web application (the aspx code) to see what was under the hood. I didn't have access to the compiled C# code, but maybe I could do something on that actual control. On the page, I found the queue view's grid, but my heart sank when I found out the entirety of the queue view came from a compiled dll! I.e. there was no way I could get to the page/control where the actual grid was put together.
I shook my head and gave a ridiculous estimate to the client because of the insanity of what I was going to have to do in order to modify this queue. Oddly enough, they accepted this lofty estimate. I kind of hoped they wouldn't, because I didn't want to have to do what they were asking :)
They wanted three major changes: they wanted numbers next to the queues that said how many items were in the queue (like the numbers next to your folders in Outlook that say how many unread items you have in them); they wanted certain queues to be shown to certain people; and they wanted the queue view to have more columns (it only starts with three and offers a very limited amount of information, almost useless, really).
Keep in mind I have no way of accessing any code that does any of what you get out of the box: it's all compiled and accessed through a dll. Microsoft would never let that code out.
So, what did I do? I'll tell you:
Step one: putting numbers next to the queues. I wrote a web service that grabs all the queues available to the logged in user in one method and counts up the number of items in a given queue in another. So, I parse through the html returned by the dll and then send the queue name (from some TD in some table somewhere in the code) to the second method mentioned before and inject some text in the TD's innerText. Wow, that's hacky. But, hey, it works, and the client loves it!
Step two: showing only the queues you want to show to certain people. Ronald Lemmen had a great blog that listed some JavaScript methods that allow you to get the user ID of the logged in user, get their roles and then test whether or not the user is in a certain role. That post is located here. So, that wasn't too difficult to modify to what I needed it to do. The way I did it was pretty slick, though. I put together all the roles and queues in two arrays, then created a JavaScript object and assigned queues to roles that way. An example would be below, granting access to the first five queues to the System Administrator.
var roleNames = new Array("System Administrator", "CEO-Business Manager", "CSR Manager", "Customer Service Representative", "DH CSR", "Marketing Manager", "Marketing Professional", "Sales Manager", "Salesperson", "Scheduler", "Schedule Manager", "SRS Management", "System Customizer", "Test CRM", "Vice President of Marketing", "Vice President of Sales");
var queueNameArray = new Array("DH Engineering", "DH PM", "DH Pro Support", "DH QA", "DH Sales", "DH Support", "DH Training", "IFIX Acctg", "IFIX Dispatch", "MPi Accounting", "MPI Engineering", "MPI Fulfillment", "MPi Implementation", "MPi Installation", "MPi Pend Rel", "MPi PM", "MPi QA", "MPi Support", "MPi Tech-Ops", "MPi Trainers");
var roleSecurities = new Object();
roleSecurities[roleNames[0]] = new Array(queueNameArray[0], queueNameArray[1], queueNameArray[2], queueNameArray[3], queueNameArray[4]);
I then hide all queues and only show them when the user has access to them.
Step three: modifying what columns are in the queue view. Normally, you would go to the customizations section and just have at it. The grid views are usually customizable. For some reason, Microsoft must not want you to modify the queue view. I had given a large estimate, time-wise, as to how long it would take to get this done, so I set out to do some serious R & D to tackle this problem. I reeeeeeally didn't want to make another web service to find out what other information was being hidden and then display it. Injecting a little parenthesized number is quite different from adding columns to a grid view.
I had researched how to get to the queue view and got nothing. So, I relented and decided to do something in the code. I needed to see what was available in the queue view, I thought, so I started outputting all the properties of the crmGrid (the ID of the grid on the queue view page). I had to bring in my own assembly to do this. I wrote a recursive method to grab the crmGrid and display its properties. I tried one thing after another and just kept hitting a brick wall
I decided to go back and see if there was anything to be gleamed from Googling modifying the queue view. I got nothing again, in the way of modifying the queue view, but I did notice this blog. It gave a way to quickly access views. It then told about a way to query string hack and get to other views. I was intrigued, to say the least.
Though the author of the blog did not list the exact queue view number, I knew that there was some JavaScript that was looking at the queue view ID on the page I was working on (Workplace/home_workplace.aspx):
function nodeSelect( sQueueId, sViewId, sMenuId )
{
crmGrid.SetParameter("viewid", sViewId);
crmGrid.SetParameter("qid", sQueueId);
crmGrid.Reset();
resetMenuItems(sMenuId);
}
So, I just alerted sViewId :)
So, the URL you need to modify the queue view is... http://crm/tools/viewEditor/viewManager.aspx?id={00000000-0000-0000-00AA-000010001400}. Obviously, change "crm" to be your CRM web application URL.
I like obliterating estimates :)
Here's what a normal queue view looks like:

Here's what it looks like with some numbers next to the queues:

And here's what it looks like with all of the columns being shown (most can only be seen when you scroll over, and this is a screenshot so you can't do that, but you get the idea):

Happy queue view hacking!