Tuesday, May 10, 2011

Set Lookup Field While Updating/Creating Record from Jscript Using CRM REST End Point


    var newaccount= new Object();
 
    newaccount.neu_name = "test";
    var contact_ref = new Object();
    contact_ref .Id = contactid;
    contact_ref .LogicalName = "contact";
    contact_ref .Name = "test contact";

    newaccount.primarycontactid = neumodelyear_ref;

//createRecord Method is available in jqueryrestdataoperationfunctions.js in SDK
    createRecord(newaccount, "accountSet", createnewaccountcompleted, null);

References:
http://technet.microsoft.com/es-ar/library/gg334767(en-us).aspx
http://technet.microsoft.com/en-us/library/gg309638.aspx
http://technet.microsoft.com/en-us/library/gg309558.aspx
http://msdn.microsoft.com/en-us/library/gg334427(MSDN.10).aspx