locked
Sending emails without relating email address to any entity RRS feed

  • Question

  • In Dynamics CRM 2011 we can send an email to any unresolved email address. For exemple, if I try to send the following (sorry, Dynamics is in Portuguese:

    Although the "To" field is an unresolved email address in Dynamics, the message will go thru, no problem here.

    But now let´s suppose I want to send an email that is in Dynamics CRM, but this email address occurs more than once (could be on Account, Contact, Contract, etc):

    In this scenario, Dynamics tells me that more than one occurrence was found and forces me to choose one of them.

    Problem is, I do not want to choose any, I just want to send the message straight away as if it was like an unresolved email, without relating to any Account ,Contact, Contract or whatever. Something like a "direct email" feature.

    Is it possible to accomplish ? Can this default feature of Dynamics be disabled ?

    Any help would be fantastic.

    Thanks,
    Fernando


    Fernando Luis

    Thursday, February 21, 2013 10:06 PM

Answers

  • On further investigation, the code I provided above will only work for the first recipient, but not additional recipients.

    To make it work every time, you just need to add an additional 2 properties to the object:

    obj.data = unresolvedValue;
    obj.type = "9206";

    I've also created a little proof of concept to show it working, I've just added a new email address field which is used to add unresolved recipients to the "to" field. To use it, you would enter an email address into the 'Add Unresolved Recipient' field, then tab/click out and the recipient will be added. The code runs onchange of this new email address field:

    function setUnresolvedRecipient() {
        var unresolvedField = Xrm.Page.getAttribute("new_addunresolvedrecipient");
        var unresolvedValue = unresolvedField.getValue();
        if (unresolvedValue != null) {
            var obj = new Object(); //create the unresolved object
            obj.name = unresolvedValue;
            obj.category = 3;
            obj.data = unresolvedValue;
            obj.type = "9206";
    
            var toField = Xrm.Page.getAttribute("to");
            var toValue = toField.getValue();
            if (toValue != null) {
                toValue.push(obj); //if there are already other values, add to it
                toField.setValue(toValue);
            }
            else {
                toField.setValue([obj]); //if 'to' field is null, just override it
            }
            unresolvedField.setValue(null); //wipe the field after adding it to the 'to' list
        }
    }

    Hope that helps

    Paul


    Saturday, February 23, 2013 6:22 AM

All replies

  • The only way this would be possible is to send the email through outlook and track it in Crm using the outlook plugin.

    hth


    Scott Durow
    Read my blog: www.develop1.net/public     Follow Me on Twitter
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Thursday, February 21, 2013 11:02 PM
    Answerer
  • I'm struggling to understand the actual reason behind this desired behaviour.

    It sounds like you're asking for CRM to not match email recipients to existing records even when it knows that the email address you're entering matches 1 or more records. Are you actually saying that it should track against all of the matching records by default (in which case Scott's suggestion would work)? Otherwise I don't believe CRM will allow you to have an unresolved recipient when it actually does match a record in the system.

    Why would you not want to relate it to the matching record?

    Paul

    Friday, February 22, 2013 5:27 AM
  • Hi Paul

    Thank you for you response.
    You are right, it sounds a little bizarre, but the reason behind this is more a business requirement.
    In our case, we have many contracts that are "managed" not directly by the customer, but by a car dealer company on behalf of a customer. This means that the same email address can exist on several contracts because one dealer takes care of more than one contract. And every time I need to send an email to this particular dealer, I am forced to choose one of the contracts that is listed, which is exactly what I am trying to avoid.
    I was wondering if a Javascript could be used to solve this problem.

    Thanks,
    Fernando

    Fernando Luis

    Friday, February 22, 2013 1:02 PM
  • Thanks Scott.

    Unfortunately this approach will not be possible because our call center agents do not use Outlook, only Dynamics web interface.

    thanks


    Fernando Luis

    Friday, February 22, 2013 1:03 PM
  • Hi Fernando,

    JavaScript could possibly be used.

    The following code can be used to set an unresolved recipient, even if that email matches a record in the system.

    var obj = new Object(); 
    obj.name = "email@domain.com"; 
    obj.category = 3;
    
    var array = new Array(); 
    array[0] = obj; 
    
    Xrm.Page.getAttribute("to").setValue(array);

    This is probably technically unsupported, however it's setting the unresolved value using the most supported method, so it should be fine going forward.

    Obviously the code above would need to be modified to work with multiple selections, and you would need to decide how to trigger that code, eg on change you might want to prompt whether to change a resolved lookup to be unresolved, or on save you could prompt and loop through all the objects in the field... This just gives you an idea of how to set the unresolved value.

    Hope that helps

    Paul

    Friday, February 22, 2013 8:09 PM
  • Thanks Paul. Looks a good approach. I will try and let you know if this works.

    Fernando


    Fernando Luis

    Friday, February 22, 2013 10:24 PM
  • On further investigation, the code I provided above will only work for the first recipient, but not additional recipients.

    To make it work every time, you just need to add an additional 2 properties to the object:

    obj.data = unresolvedValue;
    obj.type = "9206";

    I've also created a little proof of concept to show it working, I've just added a new email address field which is used to add unresolved recipients to the "to" field. To use it, you would enter an email address into the 'Add Unresolved Recipient' field, then tab/click out and the recipient will be added. The code runs onchange of this new email address field:

    function setUnresolvedRecipient() {
        var unresolvedField = Xrm.Page.getAttribute("new_addunresolvedrecipient");
        var unresolvedValue = unresolvedField.getValue();
        if (unresolvedValue != null) {
            var obj = new Object(); //create the unresolved object
            obj.name = unresolvedValue;
            obj.category = 3;
            obj.data = unresolvedValue;
            obj.type = "9206";
    
            var toField = Xrm.Page.getAttribute("to");
            var toValue = toField.getValue();
            if (toValue != null) {
                toValue.push(obj); //if there are already other values, add to it
                toField.setValue(toValue);
            }
            else {
                toField.setValue([obj]); //if 'to' field is null, just override it
            }
            unresolvedField.setValue(null); //wipe the field after adding it to the 'to' list
        }
    }

    Hope that helps

    Paul


    Saturday, February 23, 2013 6:22 AM
  • Thanks Paul for the code you provided.

    It helped me a lot.

    Fernando


    Fernando Luis

    Tuesday, February 26, 2013 2:44 PM
  • My question is, what's the big deal?  If I'm generating an email from CRM, why can't I address it to anyone?  Why does it have to be "resolved" in the first place?

    Scotty Huff

    • Edited by scottyhuff Wednesday, November 27, 2013 4:48 PM
    Wednesday, November 27, 2013 4:48 PM
  • It doesn't have to be resolved. You can send emails to unresolved recipients provided your system settings allow you to do so.

    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    Thursday, November 28, 2013 12:06 AM