locked
Set e-mail address from JavaScript RRS feed

  • Question

  • I want to set To address on the e-mail form to a specific e-mail address for example test@test.com. test@test.com does not exists as a account/contact/lead etc in the system, it is just a simple mail address. 

    I have tried some different ways like setting id and enity to null but have not found any way to solve the problem yet.
    Xrm.Page.getAttribute("to").setValue([{ id: null, name: 'test@test.com', entityType: null }]);

    Is it possible to set to address to a simple e-mail address by using JavaScript or does it only allow lookup? It is possible in the interface since I have enabled it in system settings. 

    Thursday, March 20, 2014 2:23 PM

Answers

  • Finally I got it to work!

    The solution was to set category to 3, type to 9206 and then set the e-mail address as name and data.

    Example
    Xrm.Page.getAttribute("to").setValue([{ name: "emailaddress", category: 3, data: "emailaddress", type: "9206" }]);

    Friday, May 2, 2014 12:22 PM

All replies

  • Hi Jimmy,

    Try this, it works

    var email = new Array();
    email[0] = new Object();
    email[0].id = "00000000-0000-0000-0000-000000000000";
    email[0].name = "test@test.com";
    email[0].entityType = "systemuser";
    Xrm.Page.getAttribute("to").setValue(email);
    


    Admin QuikView Solution for CRM 2013

    Thursday, March 20, 2014 3:53 PM
  • Hi! 

    Thank you for the suggestion. 
    I´m afraid that it does not work. 
    It does set the value test@test.com in the field but when I try to save the post it gives me error saying that 00000000-0000-0000-0000-000000000000 does not belong to the entity systemuser.
    I am running CRM 2013 with rollup 1 installed.


    Thursday, March 20, 2014 7:34 PM
  • Finally I got it to work!

    The solution was to set category to 3, type to 9206 and then set the e-mail address as name and data.

    Example
    Xrm.Page.getAttribute("to").setValue([{ name: "emailaddress", category: 3, data: "emailaddress", type: "9206" }]);

    Friday, May 2, 2014 12:22 PM