Hi All
I just wrote a javascript code to set the field of sales person1 in quote as the owner of the account.
Please can anyone check and let me know what i am doing wrong. as its giving me undefined in Salesperson1 field.
Thanks
function SetSalesPerson1(resultXml, userid) {
var owner= Xrm.Page.getAttribute("ownerid").getValue();
var ownerID = owner[0].id;
var ownerName = owner[0].name;
var entityType = owner[0].account;
var lookupData = new Array();
//Create an Object add to the array.
var lookupItem = new Object();
//Set the id, typename, and name properties to the object.
lookupItem.id = owner.ownerID ;
lookupItem.entityType ='account';
lookupItem.name = owner.ownerName ;
// Add the object to the array.
lookupData[0] = lookupItem;
// Set the value of the lookup field to the value of the array.
Xrm.Page.getAttribute("salesperson1id").setValue(lookupData);
}