locked
restrict email incoming when configuration is track all email messages RRS feed

  • Question

  • Guys,

    I have set for a user track all email messages.

    However I would like CRM not to create email activities for messages similar to:

    Out of office : xxxxxxxx

    This restrictions can be achived for: emails in response to CRM email, however I would like to have it for everything.

    Any idea ?

    Thursday, April 19, 2012 8:39 PM

Answers

  • Good pint I see this event is being triggered.

    CheckIncoming

    What I need is to cancel email activity creation based on subject values.

    Tried this but no works.

    if (strSubject == "TEST")
                    {
                        context.OutputParameters.Properties["ShouldDeliver"] = false;
                    }
    Any idea ?

    • Marked as answer by yojan.aguilar Wednesday, May 9, 2012 9:48 PM
    Saturday, May 5, 2012 6:06 PM

All replies

  • If that's the case, you may capture Track in CRM event with a plugin on CheckPromoteEmail & DeliverPromoteEmail messages to filter out unwanted email messages with keyword.

    Refer to the following thread for more information about it.

    http://social.microsoft.com/Forums/sv-SE/crmdevelopment/thread/98e5224f-922c-4f85-8ad8-887ef58ad19b

    Friday, April 20, 2012 1:30 AM
  • BTW, if you are ok with a bit of overhead for CRM, you might delete such emails from CRM after they get created. In that case, you will have more flexibility in terms of configuring the process (since you can use workflow designer to verify conditions). 

    You will need to either add a custom workflow activity like this one:

    http://gonzaloruizcrm.blogspot.ca/2011/06/delete-and-share-records-using-crm.html

    Or you can use some other workaround(like create a plugin that deletes emails.. you'll need to start it.. so you'll need a custom entity, that entity will reference the email which is to be deleted.. the plugin will start and delete both the email and the entity)


    Alex Shlega, GotchaHunter.Net

    Friday, April 20, 2012 2:57 AM
  • Thanks for the replies however I can not understand well how this works.

    I created a plug in for this message:

    CheckPromote

    And I simply write a "Enter Here" text  in txt file .. first line of execute method. However it never writes anything Like message is not triggered ?

    However  I see email activity is created in CRM.

     public void Execute(IPluginExecutionContext context)
            {
                string processName = "Plugin - Email CheckPromote";
                string subProcessName = "Regular Process";
                string entity = "Email";
    
                try
                {
                    File.AppendAllText(@"D:\CRM\Log\emailCheckPromote.txt", string.Format("[{0}]{1}{2}", DateTime.Now, "Step 01", Environment.NewLine));
    
                    File.AppendAllText(@"D:\CRM\Log\emailCheckPromote.txt", string.Format("[{0}]{1}{2}", DateTime.Now, "MessageName " + context.MessageName, Environment.NewLine));

    Any idea or simple sample code would be very very helpful.

    Thanks one more time.

    Friday, May 4, 2012 8:41 PM
  • Try register it on DeliverPromoteEmail and see if it is triggering.
    Saturday, May 5, 2012 3:57 AM
  • Good pint I see this event is being triggered.

    CheckIncoming

    What I need is to cancel email activity creation based on subject values.

    Tried this but no works.

    if (strSubject == "TEST")
                    {
                        context.OutputParameters.Properties["ShouldDeliver"] = false;
                    }
    Any idea ?

    • Marked as answer by yojan.aguilar Wednesday, May 9, 2012 9:48 PM
    Saturday, May 5, 2012 6:06 PM
  • As far as I know, the only way to prevent the creation of record creation in plugin is by throwing InvalidPluginExecutionException but I am not so sure that'll meet your requirement.

    Another suggestion is to write a plugin at Post Create of an Email to delete the record based on subject values.

    Monday, May 7, 2012 3:33 AM
  • Hello,

    This context.OutputParameters.Properties["ShouldDeliver"] = false;
    works in port event :)

    Nice.

    Wednesday, May 9, 2012 9:48 PM
  • Thanks for letting us know the solution that solved your problem.

    It might come in handy when we face the same situation in future development..

    Thursday, May 10, 2012 5:34 AM