Hi All,
we have a c# application which has to create Invoice in MS CRM 2013. Below snap shot shows the attributes and their values filled for the invoice object.

i get 'Incorrect attribute value type System.String' exception on the Guid id = _orgService.Create(crmInvoice); line of code.
for setting customerid have tried multiple below options but all give same error.
1st Approach
crmInvoice.Attributes["customerid"] = accountId;
crmInvoice.Attributes["customeridtype"] = 1;
on above approach failure tried 2nd below approach.
Entity customer = new Entity("customer");
customer.Id = accountId;
customer.Attributes["type"] = "account"; //1;
crmInvoice.Attributes["customerid"] = customer;
when this also failed tried 3rd approach.
crmInvoice.Attributes["customerid"] = new EntityReference("account", accountId);
This too gives same error. Kindly let me know where am going wrong. how to resolve this issue. It is turning out to be a night mare now
*This post is locked for comments
I have the same question (0)