Answered by:
Regarding Emails and Queues

Question
-
Hi All,
We have configured Email router to route incoming emails to appropriate Queues. That is working fine.
Then on creation of an email activity we have a workflow which converts the email activity to case and sets state of the email activity to completed. For few cases the emails after getting completed are still been shown in the Queue.
Can some one help us to understand where the issue might be popping
Regards,
Vikas Chitale,
Pune.
Thursday, July 22, 2010 8:38 AM
Answers
-
Get queuemanager from codeplex, open source and works out of the box!!!!!!
We use it and love it. we did have to change a little code, but not very much!
Withers *Check out my javascript working examples on my blog http://withersblog.withersdavid.com/- Marked as answer by Jim Glass Jr Thursday, July 22, 2010 3:55 PM
Thursday, July 22, 2010 3:25 PM -
hi Vikas,
This warning message comes when email contents has scripting tags in it. When you receive formatted mails, there are chances that some of the styling was done through style and/or script tags. When it finds one of these in the email message, it tends to display the warning message.
Hope this helps!
Thanks, Ranjitsingh R | http://mscrm-developer.blogspot.com/ | MS CRM Consultant- Marked as answer by Jim Glass Jr Thursday, July 22, 2010 3:55 PM
Thursday, July 22, 2010 11:10 AM
All replies
-
- Proposed as answer by HIMBAPModerator Thursday, July 22, 2010 9:14 AM
Thursday, July 22, 2010 8:55 AMModerator -
Hi Mahender,
I not able to access the because of proxy settings in our office. Can you post the details over here.
Second thing... jst found out that there are two scenarios which were common for failed records
1) The sender email address is not existing in MS CRM system
2) The message body contains text which displays a warning as "The email below might contain script or content that is potentially harmful and has been blocked." :O
Any clues??!!!....
Regards,
Vikas Chitale,
Pune.
Thursday, July 22, 2010 9:15 AM -
Hi Vikas here is the full code for this
Source :http://mayankp.wordpress.com/2010/03/02/removing-email-from-crm-queue/
Currently if there is email in queue and if user manually creates case then case gets creates but email remains in the CRM queue.
Another scenario is that there is automated workflow which creates case for the email which comes in queue and workflow creates case fine but email remains in the queue.
For above two problems there is not out of the box method to remove or detach the email from the queue. However when I check CRM 4.0 SDK there is API DetachFromQueueEmailRequest Based on which I have created following generic custom workflow which takes queue id and email id as Input and removes the relevant email from the relevant queue.
using System; using System.Workflow.Activities; using System.Workflow.ComponentModel; using Microsoft.Crm.Sdk; using Microsoft.Crm.SdkTypeProxy; using Microsoft.Crm.Workflow; using Microsoft.Crm.Sdk.Query; namespace DynamicWorkflow { [CrmWorkflowActivity("Remove the Email from the Queue")] public class RemoveEmailFromQueue : System.Workflow.Activities.SequenceActivity { //Email Id Property public static DependencyProperty activityIdProperty = DependencyProperty.Register("activityId", typeof(Lookup), typeof(RemoveEmailFromQueue)); [CrmInput("ActivityId")] [CrmReferenceTarget("email")] public Lookup activityId { get { return (Lookup)base.GetValue(activityIdProperty); } set { base.SetValue(activityIdProperty, value); } } //Queue Id Property public static DependencyProperty queueIdProperty = DependencyProperty.Register("queueId", typeof(Lookup), typeof(RemoveEmailFromQueue)); [CrmInput("queueId")] [CrmReferenceTarget("queue")] public Lookup queueId { get { return (Lookup)base.GetValue(queueIdProperty); } set { base.SetValue(queueIdProperty, value); } } //output Property public static DependencyProperty resultProperty = DependencyProperty.Register("result", typeof(string), typeof(RemoveEmailFromQueue)); [CrmOutput("result")] public string result { get { return (string)base.GetValue(resultProperty); } set { base.SetValue(resultProperty, value); } } /// <summary> /// Execute Method of Workflow /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected override System.Workflow.ComponentModel.ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { try { IContextService contextService = (IContextService)executionContext.GetService(typeof(IContextService)); IWorkflowContext context = contextService.Context; // Obtain IcrmService so we can call into CRM SDK to retrieve ICrmService crmService = context.CreateCrmService(); // this property will have the email address that needs to be matched. string strEmailGUID = activityId.Value.ToString(); //"305c2ecb-c26b-de11-9ba7-0003ff2b38e4"; // this property will have queue that needs to be matched string strQueueID = queueId.Value.ToString();// "D0B55822-436A-DE11-8911-0003FF2B38E4"; DetachFromQueueEmailRequest objEmail = new DetachFromQueueEmailRequest(); // Assign Email GUID objEmail.EmailId = new Guid(strEmailGUID.Trim()); // Assign Queue GUID objEmail.QueueId = new Guid(strQueueID.Trim()); //execute request to removed it from queue DetachFromQueueEmailResponse response= (DetachFromQueueEmailResponse)crmService.Execute(objEmail); this.result = "Success"; return ActivityExecutionStatus.Closed; } catch(Exception ex) { return ActivityExecutionStatus.Canceling; } } } }
MahainThursday, July 22, 2010 9:48 AMModerator -
Hi Mahendra,
Thanks for the post....
This will be the last resort in order to overcome this issue. However the workflow is working fine for most of the other records.
Can you throw some light on the 2 scenarios I mentioned above!!!
Regards,
Vikas Chitale,
Pune.
Thursday, July 22, 2010 9:53 AM -
hi Vikas,
This warning message comes when email contents has scripting tags in it. When you receive formatted mails, there are chances that some of the styling was done through style and/or script tags. When it finds one of these in the email message, it tends to display the warning message.
Hope this helps!
Thanks, Ranjitsingh R | http://mscrm-developer.blogspot.com/ | MS CRM Consultant- Marked as answer by Jim Glass Jr Thursday, July 22, 2010 3:55 PM
Thursday, July 22, 2010 11:10 AM -
Hi Ranjit,
Thanks for that. We were aware about the meaning of message coming over the email body.
My query was actually why is the workflow failing for such records?? And if it works the completed email is still listed in the Queue... :(
Regards,
Vikas Chitale,
Pune.
Thursday, July 22, 2010 11:46 AM -
Get queuemanager from codeplex, open source and works out of the box!!!!!!
We use it and love it. we did have to change a little code, but not very much!
Withers *Check out my javascript working examples on my blog http://withersblog.withersdavid.com/- Marked as answer by Jim Glass Jr Thursday, July 22, 2010 3:55 PM
Thursday, July 22, 2010 3:25 PM -
Thanks David,
Will look into it...
Regards,
Vikas Chitale,
Pune.
Friday, July 23, 2010 6:42 AM -
We just discovered that this issue will occur when emails that have any sort of formatting (bolding, italics, etc) are copied and pasted from Outlook into a CRM email. After some testing we determined that CRM will not accept formating from any other word processing program, including its sister program Outlook. To overcome this, you can still copy and paste from Outlook but you must then highlight all the text and remove any formatting from within the CRM email window. You can then reformat within the CRM email window.
Hope this helps.
Monday, August 30, 2010 6:25 PM