Why does IOrganizationService.Update() return "The specified record type does not exist in Microsoft Dynamics CRM."? -
a call update record in early-bound custom entity, record retrieved, returns above message. code fragment follows (heavily instrumented i'll leave in i'm new crm code , might remove someting relevant)
// retrieve , update contactfact record - string strcontactfactid = reader["contactfactid"] == dbnull.value ? string.empty : (string)reader["contactfactid"]; string strcontactid = reader["contactid"] == dbnull.value ? string.empty : (string)reader["contactid"]; whereami = "retrieved strcontactid = " + strcontactid; string straccountid = reader["accountid"] == dbnull.value ? string.empty : (string)reader["accountid"]; guid contactfactid; guid contactid; guid accountid; guid.tryparse(strcontactfactid, out contactfactid); whereami = "try generate contactid " + strcontactid; guid.tryparse(strcontactid, out contactid); whereami = "generated contactid = " + contactid.tostring(); guid.tryparse(straccountid, out accountid); int score = reader.getint32(3); whereami = "try retrieve contactfact " + contactfactid.tostring(); sbtls_contactfact contactfact = (sbtls_contactfact)service.retrieve("sbtls_contactfact", contactfactid, columnset); // xx prob don't need retrieve current values whereami = "try set sbtls_contactid " + contactid.tostring(); contactfact.sbtls_contactid = contactid == guid.empty ? null : new entityreference("contact", contactid); whereami = "successfully set sbtls_contactid " + contactid.tostring(); contactfact.sbtls_accountid = accountid == guid.empty ? null : new entityreference("account", accountid); contactfact.sbtls_score = score; contactfact.sbtls_fact = "updated contactid " + strcontactid + " parsed guid " + contactid.tostring(); whereami = "about update"; service.update(contactfact); whereami = "updated";
you need change these 2 line:
contactfact.sbtls_contactid = contactid == guid.empty ? null : new entityreference("contact", contactid);
contactfact.sbtls_accountid = accountid == guid.empty ? null : new entityreference("account", accountid);
to use lowercase entityreference.logicalname
values, reads like:
contactfact.sbtls_contactid = contactid == guid.empty ? null : new entityreference("contact", contactid);
contactfact.sbtls_accountid = accountid == guid.empty ? null : new entityreference("account", accountid);
the logical name case sensitive , should lower-case.
Comments
Post a Comment