Hi,
I'm trying to create a new record and set the field "customerid" lookup with a value that come from another "customerid" lookup.
Here's the code i use :
var client = Xrm.Page.getAttribute("customerid").getValue();
var customerObj = new Object();
customerObj.Id = client[0].id;
customerObj.Name = client[0].name;
var devisObj = new Object();
devisObj.CustomerId = customerObj;
var jsonEntity = window.JSON.stringify(devisObj);
When i execute the create request, i get an error.
I think this it's because in the customerid lookup, it's possible to choose "Account" or "Contact" and i have to specify the entityType or not ?
I've tried this
var customerObj = new Object();
customerObj.Id = client[0].id;
customerObj.Name = client[0].name;
customerObj.EntityType = client[0].entityType;
var devisObj = new Object();
devisObj.CustomerId = customerObj;
var jsonEntity = window.JSON.stringify(devisObj);
Without success !
Someone to help me ? I don't know how i can set customerid in a create request.
Thank your very much for your help.
Jean Michel