Set default e-mail address RRS feed

  • Question

  • Hi,
    I'm trying to set the default e-mail address when sending email from CRM.
    I have the contactid of the specific contact but my script wont work.

    Any ideas?

    var authenticationHeader = GenerateAuthenticationHeader();
    // Prepare the SOAP message.
    var xml = "<?xml version='1.0' encoding='utf-8'?>"+
    "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'"+
    " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'"+
    " xmlns:xsd='http://www.w3.org/2001/XMLSchema'>"+
    "<Retrieve xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>"+
    "<columnSet xmlns:q1='http://schemas.microsoft.com/crm/2006/Query' xsi:type='q1:ColumnSet'>"+
    // Prepare the xmlHttpObject and send the request.
    var xHReq = new ActiveXObject("Msxml2.XMLHTTP");
    xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
    xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
    xHReq.setRequestHeader("Content-Length", xml.length);
    // Capture the result.
    var resultXml = xHReq.responseXML;
    // Check for errors.
    var errorCount = resultXml.selectNodes('//error').length;
    if (errorCount != 0)
      var msg = resultXml.selectSingleNode('//description').nodeTypedValue;
    // Populate fields with data
    Sunday, November 15, 2009 8:46 PM


  • The from lookup DataValue is a pointer to the contact record  and not the email address itself.

    Secondly, the lookup value is not a simple string but an array that holds the pointer information e.g. record id, name, type of entity.

    If you already know the default contactid then use the following line as an example:

    crmForm.all.from.DataValue = [{id:”66F26D9C-C12D-4ADE-B912-5DF3B540A2E6”,name:”Default Sender”,type:2,typename:"contact"}]

    GI CRM Blog * GI Website
    Sunday, November 15, 2009 10:49 PM