Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 55831

Problem creating incident from code : customer attribute is always null

$
0
0

Hi,

I'm trying to create an incident from a C3 console application, but I'm always getting the following error: 

Attribute 'customerid' cannot be NULL

I've tried using both early and late bound and XrmContext and OrganizationServiceProxy

Incident xx = new Incident() {
Title = rm.whatHappned,
OverriddenCreatedOn = rm.createdDate,
CustomerId = new CrmEntityReference(Account.EntityLogicalName, new Guid("76694771-5d2c-e511-80c6-0050568f430a"))
};


EntityReference cer = new EntityReference();
cer.Id = new Guid("76694771-5D2C-E511-80C6-0050568F430A");
cer.LogicalName = Account.EntityLogicalName;
cer.Name = "AccountName"

Entity newIncident = new Entity("incident");
newIncident.Attributes.Add("customerid", cer);
newIncident["overriddencreatedon"] = rm.createdDate;


I even tested that the attribute is not null before trying to create!

if (newIncident.Contains("customerid") && newIncident["customerid"] != null) {
service.Create(newIncident)
}
else
log("CustomerID is null"); //this one is never shown in the logs...

I was able to create an account with parent account without any problems, using the same CustomerID-GUID. 

CRM is OnPremise 2015 v.7.0.1.129.


Viewing all articles
Browse latest Browse all 55831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>