dynamics crm - CRM Error When Assigning Lookup Value Incorrect type of attribute value System.Int32 -
on crm 2011 i'm writing c# create new accounts reading .csv spreadsheet. account entity has lookup field "salesperson" lookup value against crm "systemuser" entity. "salesperson" field fixed value, i'm assigning systemuser guid it. got error "incorrect type of attribute value system.int32" when trying assign lookup value using systemuser guid. correct way assign guid value?
thanks in advance help.
uri organizationuri = new uri("https://mycrm.org.com/crmtest/xrmservices/2011/organization.svc"); var cred = new clientcredentials(); organizationserviceproxy _serviceproxy = new organizationserviceproxy(organizationuri, null, cred, null); _service = (iorganizationservice)_serviceproxy; program p = new program(); entity account = new entity("account"); account.attributes["salesperson"] = "69aca8f0-78b9-c211-b753-99e3b511a6f7"; guid g2 = p._service.create(account);
i'm not or how getting incorrect type of attribute value system.int32
have thought subset of code, i.e., program p = new program();
doing , how assigned _service
?
per crm sdk there no field on crm 2011's account entity called salesperson
(http://msdn.microsoft.com/en-us/library/gg328057.aspx). i'm assuming custom field added entity , name should xxxx_salesperson
. @ customization of entity find schema name of field.
next, can't assign guid directly lookup field. need assign entityreference should read:
account.attributes["salesperson"] = new entityreference("systemuser", guid.parse("69aca8f0-78b9-c211-b753-99e3b511a6f7"));
Comments
Post a Comment