locked
CRM 2013 - Trying to set the "From" field on am email to a system user on load RRS feed

  • Question

  • Hi All, 

    I have a requirement to default the "from" field on the email entity upon load.  I have written the below code. I know it is not best proactive to code a GUID, but I need this for a demo. The below script is on load.  I do not get any errors when I run the code, the value of the "from field" becomes null. Any help would be much appreciated. 

    function setPartyList() {

    var partyRequired = Xrm.Page.getAttribute("from");

    // Create new array

    var partlist = new Array();

    partlist[0] = new Object();

    partlist[0].id = "fb2ccc5f-6e18-4ca2-8caf-361b6e1c1724"; //Guid (i.e., Guid of User or Contact etc)

    partlist[0].name = "Joe Schmo"; //Name (i.e., Name of User or Contact etc)

    partlist[0].entityType = 8; //entity schema name of account or contact

    // Set array value

    partyRequired.setValue(partlist);

    }

    Thursday, January 15, 2015 5:31 AM

All replies

  • Hello,

    You should change line

    partlist[0].entityType = 8;

    with line

    partlist[0].entityType = "systemuser";


    Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
    My blog

    Thursday, January 15, 2015 7:14 AM
    Moderator