CRM 2011: Removing Email from queue
Last year I blogged about this on CRM 4.0 but since last few months lots of users queried about similar solution for CRM 2011. This blog entry hopefully will provide solution for this.
Well solution logic is same as CRM 4.0, we will create custom workflow which will take email id and source queue id as input parameter and then custom will removed this email from relevant queue.
I have done following are steps to achieve this in CRM 2011.
Step 1:
Create new VS studio project and add necessary reference (i.e. Microsoft.Xrm.Sdk , Microsoft.Xrm.Sdk.Workflow etc.). for more information on how to create custom workflow activity for 2011 refer following article
http://technet.microsoft.com/en-us/library/gg328515.aspx
Step 2 :
Add new class called RemoveEmail.cs and I have provided full source code for this class at end of this article. (or it can be downloaded from http://snipt.org/xoGi)
Step 3 :
Register custom workflow assembly on 2011 dynamics server using Plug in Registration Tool.
for more information on how to register custom workflow activity for 2011 refer following article http://technet.microsoft.com/en-us/library/gg328515.aspx
Step 4:
following screen print of on demand workflow I have created for this in CRM 2011 for testing purpose.

That’s it, Done. if you need more information or got any more queries regarding this please drop comment below.
Hope this helps..
Cheers,
MayankP:)
Source Code
using System;
using System.Activities;
using Microsoft.Xrm.Sdk.Workflow;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
using Microsoft.Xrm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Discovery;
using Microsoft.Xrm.Sdk.Client;namespace CRM2011WorkflowUtilities
{
public class RemoveEmail : CodeActivity
{
protected override void Execute(CodeActivityContext executionContext)
{
try
{
//Create the context and tracing service
IExecutionContext context = executionContext.GetExtension();
IOrganizationServiceFactory serviceFactory = executionContext.GetExtension();
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
ITracingService tracer = executionContext.GetExtension();EntityReference incomingEmail = activityId.Get(executionContext);
string emailID = incomingEmail.Id.ToString();EntityReference incomingQueue = queueId.Get(executionContext);
string queueID = incomingQueue.Id.ToString();//Get the QueueItemID
Guid queueItemId = GetQueueItem(service,emailID,queueID);//delete relevant queue item record and it will remmoved email from queue
if (queueItemId != Guid.Empty)
{
service.Delete("queueitem", queueItemId);
}
}
catch (Exception ex)
{
Helpers.Throw(String.Format("An error occurred in the {0} plug-in.",
this.GetType().ToString()),
ex);
}return;
}///
/// Retrieve Queue Item for this email and queue
//////
///
///
///
private Guid GetQueueItem(IOrganizationService service,string emailGUID,string QueueGUID)
{
Guid queueItemId = Guid.Empty;// Share the same access rights as the user, so we must retrieve the user's access rights to the record
QueryExpression qe = new QueryExpression();
qe.EntityName = "queueitem";
qe.ColumnSet = new ColumnSet();
qe.ColumnSet.AllColumns = true;FilterExpression filter = new FilterExpression();
ConditionExpression hasEmailId = new ConditionExpression();
hasEmailId.AttributeName = "objectid";
hasEmailId.Operator = ConditionOperator.Equal;
hasEmailId.Values.Add(emailGUID) ;ConditionExpression hasQueueId = new ConditionExpression();
hasQueueId.AttributeName = "queueid";
hasQueueId.Operator = ConditionOperator.Equal;
hasQueueId.Values.Add(QueueGUID);filter.Conditions.Add(hasEmailId);
filter.Conditions.Add(hasQueueId);qe.Criteria = filter;
EntityCollection ec = service.RetrieveMultiple(qe);
if (ec != null && ec.Entities.Count > 0)
{
queueItemId = ec.Entities[0].Id;
}return queueItemId;
}
#region Input Parameters
[RequiredArgument]
[Input("Source Email Id")]
[ReferenceTarget("email")]
public InArgument activityId { get; set; }[Input("queue Id")]
[ReferenceTarget("queue")]
public InArgument queueId { get; set; }#endregion
#region Output Parameters
#endregion
}
}
Funny error messages
CRM 2011 Tip: hiding start pane on CRM entities
Few of our users did not like this started pane in CRM 2011 and asking us if we disable this.
User settings
Following steps individual user can do to remove this started pane
Step 1: Go to File -> Options -> General tab
Step 2: un- tick “Show Get started panes on all lists” and click ok
System settings
System admin can switch this setting off for all users by doing following steps.
Step 1: go to Settings -> Administration -> system settings – > General tab
Step 2: set “Show Get Started panes on all lists of all users “ to “NO” and click ok
Hope this helps..
Cheers,
MayankP:)
CRM Outlook client Installation issue
One of my colleagues had following issue while installing latest CRM roll up for outlook client.
Installation cannot proceed: Setup cannot continue because a pending restart is required. Restart the computer and then try running Setup again
Please read this article for the solution regarding this.
Hope this helps…
Regards,
MayankP
CRM 4.0 Printing Error – This form has been changed and must be saved before printing.
One of user posted this error in this CRM thread, we had similar issue some time back and one of my colleagues had resolved this issue.
Problem
This error comes if you got java script code which is constantly updating some variables in the back ground. This makes CRM Form engine believes that form has been changed so CRM print function will not allow you print CRM form.
Solution
The solution for this is that we over ride existing CRM print on click event and write function to run this print job manually.
Following is example script for Phone call entity. This script needs to put in to the Form On Load Event.
Following text version of above code, change the object type code as per your requirement.
if (document.getElementById('_MBcrmFormPrint') != null)
{
document.getElementById('_MBcrmFormPrint').action = ' openStdWin(prependOrgName("/_forms/print/print.aspx?objectType=4210&id=" + crmForm.ObjectId + "&title=" + CrmEncodeDecode.CrmUrlEncode(parent.document.title))); ';
}
Hope this helps!!
Note: - This is unsupported change so please make sure you take necessary back up before doing this change.
Cheers,
MayankP
CRM 4.0 Email Tracking Issues
Recently we started getting following errors in CRM 4.0 outlook client while tracking any email or setting regarding for any email in outlook.
Error 1
“An error occurred promoting this item to Microsoft Dynamics CRM. The Microsoft Dynamics CRM server count not be contacted or the user has insufficient permission to perform this action”
Error 2
“The Requested record was not found or you do not have sufficient permission to view it”
Solution
Based on this KB Articles , following are steps to resolve this issue.
Step 1: Clear the outlook cache as specified in following screen print.

Note: these steps are for outlook 2010.
Step 2: clear down IE Temporary files as mentioned in following steps.
1.Open IE- > go to Tools -> Click Internet Options
2. On Browsing history section, click on Delete and then delete all the IE temporary data.
Once above steps are done, close your outlook and then start again.
Hope this helps!!!
Cheers,
MayankP
Microsoft Community Contributor Award
Last Month, I was honoured to receive recognition by Microsoft for contributions to the Microsoft online technical communities with the Microsoft Community Contributor Award.
Thanks Microsoft and to you who nominated me!
Additional information about the Microsoft Community Contributor Award Program can be found at
http://www.microsoftcommunitycontributor.com
Cheers,
MayankP
CRM 4.0 Issue: IE window display full path in Title bar
Suddenly few of our CRM user started seeing full path in CRM IE Title bar.
After little trial and error method we found that issue was cause by change in Domain Policy and to fix this issue on individual users system we did following steps…
Step 1: open IE -> Tools -> Internet Options
Step 2: go to security tab
Step 3: select Local intranet/trusted sites deepening upon where your CRM sites are added
Step 4: Click on Custom Level
Step 5: and the go to the Miscellaneous section and find option called “Allow script-initiated windows without size or position constraints”
Step 6: Select Enabled and click Ok
Step 7: Restart all IE Sessions and this issue will be fixed.
Hope this helps,
Cheers,
MayankP
CRM 2011 Vidoes
Following are top 10 videos to kick start on CRM 2011.
1. Conditional Formatting in the Outlook CRM Client
2. User Experience Demo
3. CRM 2011 – Teams, Queues, Sales Literature
4. CRM 2011 Workflows: Dialogs
5. Goal Metrics and Goals
6. Charts and Dashboards
7. CRM 2011 – Sharepoint Integration
8. CRM 2011 – solution management
9. CRM 2011 – Connections
10. CRM 2011 – Auditing
Hope this helps..
Cheers,
MayankP
Dynamics CRM 2011 update
As you aware CRM dynamics 2011 beta was released in September 2010, now following is link to register for global launch of Dynamics CRM 2011 on 20th January 2011.
http://crm.dynamics.com/2011launch/
Also Dynamics CRM 2011 Release Candidate (RC) is now available for download in the Microsoft Download Centre. Following is details for the same from Dynamics CRM Team Blog.
Microsoft Dynamics CRM 2011 Server Release Candidate
http://www.microsoft.com/downloads/details.aspx?FamilyID=c3f82c6f-c123-4e80-b9b2-ee422a16b91d
Available in English only
Microsoft Dynamics CRM 2011 for Microsoft Office Outlook
http://www.microsoft.com/downloads/details.aspx?FamilyID=22dc423a-7194-491e-a169-6ace16bfdd36
Available in 25 languages
Microsoft Dynamics CRM 2011 Language Pack
http://www.microsoft.com/downloads/details.aspx?FamilyID=db44c564-2338-407e-980a-c9c83ad37729Available in 41 languages
Microsoft Dynamics CRM 2011 E-mail Router
http://www.microsoft.com/downloads/details.aspx?FamilyID=a995f6ad-0099-42fd-9b22-cf7b3d40a2bf
Available in 25 languages
Microsoft Dynamics CRM 2011 Report Authoring Extension
http://www.microsoft.com/downloads/details.aspx?FamilyID=64a09b75-8376-4b9d-aea3-8a83a1837c4d
Available in 25 languages
Microsoft Dynamics CRM 2011 List Component for Microsoft SharePoint Server 2010
http://www.microsoft.com/downloads/details.aspx?FamilyID=23c0f351-8694-4d92-9ddf-34a949aec6a7
Available in 41 languages
Cheers,
MayankP:)









