locked
Using an RSS Feed to update users when a new item has been added to a queue RRS feed

  • Question

  • Hello All

    I am after an application that will let users know when a Queue has a new Item.  An RSS feed would be perfect for this.  Does anybody know if this is possible.

    I have already used the MSCRM Notifications Accelerator ( http://www.codeplex.com/crmaccelerators/Release/ProjectReleases.aspx?ReleaseId=19071 ) which provides RSS feeds on views but this does not work for Queues.
    I have also seen the VISTA Sidebar Gadget for Queues but this is not suitable as ALL my users are on XP.

    Can anybody reconmend a way I can notify users there is a new item in a Queue without making them log in to CRM?

    T

    Your Trusted Technology Partner
    • Edited by TD-CRM Wednesday, September 30, 2009 5:20 PM html incorrect
    Wednesday, September 30, 2009 4:57 PM

Answers

  • Carlton,  Thank you for your excelent answer.

    However I was determined not to write code for an answer.  I have managed to get away with it so far :)

    In the end I came up with the following.

    Since the RSS for Dynamics CRM 4.0 allows you to create RSS feeds for most views I had to find a way of generating a view which would show the emails in the queue.

    I created an Advanced Find Looking at E-mail looking at email messages with the following

    Select
             Queue Items (Object)
                      Select
                               Queue
                                        Queue   Equals "Support Email Queue"

    Then subscribe to the new View in the RSS windows

    Works a treat but only for emails.  For me this is Fine


    Your Trusted Technology Partner
    • Marked as answer by TD-CRM Thursday, October 1, 2009 10:23 AM
    Thursday, October 1, 2009 10:23 AM

All replies

  • This one really interested me, so I tried out a couple of ideas and while I think SQL to RSS is much easier and faster, I have provided the source code for using the SDK and fetchxml (you could use generated queries) on my blog, mcscrmblogger.com

    Click here to view the Queue Item RSS as an Example I wrote.

    Here is that code...

    using System;
    using System.Net;
    using System.Text;
    using System.Web.UI;
    using System.Xml;
    using CRMQIRSS.crmsdk;
    
    namespace CRMQIRSS
    {
        public partial class _Default : Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                var QueueName = String.Empty;
    
                try
                {
                    QueueName = Request["q"];
                }
                catch
                {
                    // Ignore Errors
                }
    
    
                // Clear Any Response
                Response.Clear();
                Response.ContentType = "text/xml";
    
                var xtwFeed = new XmlTextWriter(Response.OutputStream, Encoding.UTF8);
                xtwFeed.WriteStartDocument();
                // Setup Feed
    
                xtwFeed.WriteStartElement("rss");
                xtwFeed.WriteAttributeString("version", "2.0");
    
                // Setup Channel
                xtwFeed.WriteStartElement("channel");
                xtwFeed.WriteElementString("title", QueueName);
                xtwFeed.WriteElementString("link", "http://www.mscrmblogger.com");
                xtwFeed.WriteElementString("ttl", "5");
                xtwFeed.WriteElementString("description", "The most technical and solution rich CRM blog.");
                xtwFeed.WriteElementString("copyright", "Copyright 2009 mscrmblogger.com. All rights reserved.");
    
                // Get the Dataset
                BusinessEntityCollection becQueueItems;
                if (String.IsNullOrEmpty(QueueName))
                {
                    becQueueItems = GetQueueItemsByCurrentUser();
                }
                else
                {
                    becQueueItems = GetQueueItemsByName(QueueName);
                }
    
                foreach (var be in becQueueItems.BusinessEntities)
                {
                    var qi = (queueitem) be;
    
                    var description = "Created: " + Convert.ToDateTime(qi.createdon.Value).ToString("f");
    
                    xtwFeed.WriteStartElement("item");
    
                    xtwFeed.WriteElementString("title", qi.title);
    
                    xtwFeed.WriteElementString("description", description);
    
                    String objecttypecode;
                    switch (qi.objecttypecode.Value)
                    {
                        case "incident":
                            objecttypecode = "112";
                            break;
                        case "task":
                            objecttypecode = "4212";
                            break;
                        case "phonecall":
                            objecttypecode = "4202";
                            break;
                        case "letter":
                            objecttypecode = "4207";
                            break;
                        case "serviceappointment":
                            objecttypecode = "4214";
                            break;
                        case "fax":
                            objecttypecode = "4204";
                            break;
                        case "email":
                            objecttypecode = "4202";
                            break;
                        case "campaignactivity":
                            objecttypecode = "4402";
                            break;
                        case "campaignresponse":
                            objecttypecode = "4401";
                            break;
                        default:
                            objecttypecode = "0";
                            break;
                    }
    
    
                    xtwFeed.WriteElementString("link",
                                               "http://crm/CRMReports/viewer/drillopen.aspx?ID=" + qi.objectid.Value +
                                               "&OTC=" + objecttypecode);
    
                    xtwFeed.WriteElementString("pubDate", Convert.ToDateTime(qi.enteredon.Value).ToString("f"));
    
                    xtwFeed.WriteElementString("author", qi.createdby.name);
    
                    //TODO: Lookup the queue...  this would be quicker (and easier) with SQL...
                    //xtwFeed.WriteElementString("category", "queue/" + qi.queueid);
    
                    xtwFeed.WriteEndElement();
                }
    
    
                // Close all tags
                xtwFeed.WriteEndElement();
                xtwFeed.WriteEndElement();
                xtwFeed.WriteEndDocument();
                xtwFeed.Flush();
                xtwFeed.Close();
                Response.End();
            }
    
            private CrmService GetCrmServiceConnection(String Organization)
            {
                var token = new CrmAuthenticationToken();
                token.AuthenticationType = 0; //AD
                token.OrganizationName = Organization;
    
                var crmService = new CrmService();
                crmService.CrmAuthenticationTokenValue = token;
                crmService.Credentials = CredentialCache.DefaultCredentials;
    
                return crmService;
            }
    
            private BusinessEntityCollection FetchDataSet(string fetchXml)
            {
                var service = GetCrmServiceConnection("OrganizationXYZ");
    
                var request = new FetchXmlToQueryExpressionRequest();
                request.FetchXml = fetchXml;
    
                var response = (FetchXmlToQueryExpressionResponse) service.Execute(request);
    
                var items = service.RetrieveMultiple(response.Query);
    
                return items;
            }
    
            private BusinessEntityCollection GetQueueItemsByName(String queueName)
            {
                var fetchXML = "<fetch mapping=\"logical\" count=\"50\" distinct=\"true\">" +
                               "	<entity name=\"queueitem\">" +
                               "		<all-attributes />" +
                               "		<link-entity name=\"queue\" from=\"queueid\" to=\"queueid\">" +
                               "			<attribute name=\"name\" />" +
                               "			<filter>" +
                               "				<condition attribute=\"name\" operator=\"like\" value=\"%" +
                               queueName +
                               "%\" />" +
                               "			</filter>" +
                               "		</link-entity>" +
                               "	</entity>" +
                               "</fetch>";
    
                return FetchDataSet(fetchXML);
            }
    
            private BusinessEntityCollection GetQueueItemsByCurrentUser()
            {
                var fetchXML = "<fetch mapping=\"logical\" count=\"50\" distinct=\"true\">" +
                               "	<entity name=\"queueitem\">" +
                               "		<all-attributes />" +
                               "		<link-entity name=\"queue\" from=\"queueid\" to=\"queueid\">" +
                               "			<attribute name=\"name\" />" +
                               "			<filter>" +
                               "				<condition attribute=\"primaryuserid\" operator=\"eq-userid\" />" +
                               "			</filter>" +
                               "		</link-entity>" +
                               "	</entity>" +
                               "</fetch>";
    
                return FetchDataSet(fetchXML);
            }
        }
    }

    Wednesday, September 30, 2009 8:58 PM
  • You can use a workflow rule to send an email to the users you want to alert.
    For example, you can create a rule for the Email entity, that is triggered when a new email activity is created. The first line should check to see if the queue is a recipient of the email. If it is, send an email to the user you wish to alert telling them there's a new email in the queue.
    Matt Wittemann, MVP for CRM (http://icu-mscrm.blogspot.com)
    Wednesday, September 30, 2009 9:00 PM
    Moderator
  • We do that where I work and it has created a ton of messages sent and a ton of activities on every case, etc.   Not only that, but we allow our customers to see our notes and tasks through a portal, and if they see you were notified, then they expect you to be aware.  So if we notify someone high up in the company it sets the wrong level of expectation.

    The RSS feed is better in my opinion because people can either use it or not.  It is optional.  They can setup something to automatically notify them, or they could setup trackers for other queues even if they are other people's queues (like the people they manage) and it takes the work away from the CRM admin and puts it on the individual.  If you do something complex like overlapping monitoring of different queues, it can be a pain to manage email notifications.

    Wednesday, September 30, 2009 10:47 PM
  • Carlton,  Thank you for your excelent answer.

    However I was determined not to write code for an answer.  I have managed to get away with it so far :)

    In the end I came up with the following.

    Since the RSS for Dynamics CRM 4.0 allows you to create RSS feeds for most views I had to find a way of generating a view which would show the emails in the queue.

    I created an Advanced Find Looking at E-mail looking at email messages with the following

    Select
             Queue Items (Object)
                      Select
                               Queue
                                        Queue   Equals "Support Email Queue"

    Then subscribe to the new View in the RSS windows

    Works a treat but only for emails.  For me this is Fine


    Your Trusted Technology Partner
    • Marked as answer by TD-CRM Thursday, October 1, 2009 10:23 AM
    Thursday, October 1, 2009 10:23 AM