Making a one-click link for a CRM 2011 Queue

My requirement today, ws to make a single-click method to display a stripped down version of a Queue view.  I wanted the user to have a very clean list of their work objects and give them as few steps as necessary to mark an item as completed and move it on down the line.

Step One - Create Your View

First, create the view, of the queue, that you want the person to see. I had added a few extra fields to the Queue item entity that I wanted to be displayed to the user.

So I made a new View in the Queue Items entity in the Settings> Customizations section.

Step Two - Create Your Work Flows

Create the work flow that you want to carry out the automated tasks. In my case, I wanted the queue item to be moved to another queue and update a couple of fields on the related entity. 

Make your workflow, then test it against the queue item to make sure that it works. 

Step Three - Add the Button For The Workflow

In my case, I wanted a single touch button to execute the workflow on the selected records. The easiest way to do this, is using the Ribbon Bar editor that is available from Microsoft Codeplex here:  CRM 2011 Visual Ribbon Editor

Step Three (b) - Add A Little Scripting

Next you need a little Javascript... just a little. You can copy and paste into a new WebResource.  (Credit: AKILAN AKI)

 

function TriggerWorkflow(workflowGuid) {


/*Generate Soap Body.*/
var soapBody = "<soap:Body>" +
" <Execute xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>" +
" <Request xsi:type=\'ExecuteWorkflowRequest\'>" +
" <EntityId>" + Xrm.Page.data.entity.getId() + "</EntityId>" +
" <WorkflowId>" + workflowGuid + "</WorkflowId>" +
" </Request>" +
" </Execute>" +
"</soap:Body>";

/*Wrap the Soap Body in a soap:Envelope.*/
var soapXml = "<soap:Envelope " +
" xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' " +
" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " +
" xmlns:xsd='http://www.w3.org/2001/XMLSchema'>" +
GenerateAuthenticationHeader() +
soapBody +
"</soap:Envelope>";

/* Create the XMLHTTP object for the execute method.*/
var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
xmlhttp.open("POST", "/MSCRMservices/2007/crmservice.asmx", false);
xmlhttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlhttp.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Execute");

/* Send the XMLHTTP object. */
xmlhttp.send(soapXml);
alert("The workflow has been triggered successfully");

}

There is a fantastic writeup on how to add buttons to your bar for the workflow, by , which can be found here: 

http://akilanaki.blogspot.ca/2012/10/crm-2011-trigger-workflow-process-from.html

Step Three (c) - Removing Unneeded Buttons

I didn't want this workstation to have all the standard buttons on the ribbon bar. They wouldnt be using them and it made sense to clean them up.

Using the Ribbon Bar editor, you can hide the unneeded buttons very easily. Any sections that have all buttons hidden will not appear on the form. 

Step Four - Create The Single Click Link

Finally, you can create the URL for your link! 

Navigate to the queue and the view that you want. In my case, it is called 'Shop Queue'. In the CRM ribbon bar, click the Copy A Link button and select 'Of Current View'. Paste this into a notepad or similar text editor.

It should look something like this:

Shop Queue //main.aspx?etc=2029&extraqs=%3fpagemode%3diframe%26queueid%3d%257BE6E9DD02-7DF8-B397-92CA2BV31071%257d%26sitemappath%3dWorkplace%257cMyWork%257cnav_queues&pagetype=entitylist&viewid=%7bE6EEFF9A-39F9-B327-96CA2BB31071%7d&viewtype=1039>

Strip off the text and opening & closing chevrons. (< & >)  resulting in:

http:////main.aspx?etc=2029&extraqs=%3fpagemode%3diframe%26sitemappath%3dWorkplace%257cMyWork%257cnav_queues&pagetype=entitylist&viewid=%7bE6EEFF9A-39F9-E211-B327-96CA2BB31071%7d&viewtype=1039&viewid=%7bE1EEFF2A-39F9-E211-B327-96CA2BB31071%7d&viewtype=1039

Step Four (b) - Link To Your Queue

Now, at the moment, this link will just take you to that view, (without the left navigation bar). However it will default to ALL QUEUES. 

To make it also select the specific Queue, you need the Queue Id.  To find this, go to the Settings part of CRM and then Business Management > Queues. Open your desired queue and then press CONTROL + N to open it in a new window. 

Copy the URL and paste that into the notepad window underneath your other copied URL. Look through the newly pasted URL for 'id=%7b ...... %7d' and copy the GUID part of the string only (with the %7d and %7b)

http:////tools/queuingmanager/edit.aspx?id=%7bE5E9AD04-7DF8-B327-96CA2BB41071%7d

Next, in the first URL you copied from the queue view, find the string  '&extraqs='.

http:////main.aspx?etc=2029&extraqs=%3fpagemode%3diframe%26sitemappath%3dWorkplace%257cMyWork%257cnav_queues&pagetype=entitylist&viewid=%7bE1EEFF2A-39F9-B327-96CA2BB31071%7d&viewtype=1039

This will be followed by some more options. Find the next '&' (ampersand) after the &extraqs=:

http:////main.aspx?etc=2029&extraqs=%3fpagemode%3diframe%26sitemappath%3dWorkplace%257cMyWork%257cnav_queues---> & <----pagetype=entitylist&viewid=%7bE1EEFF2A-39F9-B327-96CA2BB31071%7d&viewtype=1039

add the following: '%26queueid=' and paste the GUID url you have copied, just before that ampersand. So it should look like this:

http:////main.aspx?etc=2029&extraqs=%3fpagemode%3diframe%26sitemappath%3dWorkplace%257cMyWork%257cnav_queues%26queueid=%7bE5E9AD04-7DF8-B327-96CA2BB41071%7d&pagetype=entitylist&viewid=%7bE1EEFF2A-39F9-B327-96CA2BB31071%7d&viewtype=1039

And there you have a single click link to your dedicated view and queue.