I'm looking for ways of debugging an error I'm getting when trying to write a record to CRM Online:
An unhandled exception of type 'System.ServiceModel.FaultException`1' occurred in Microsoft.Xrm.Sdk.dll
Additional information: Generic SQL error.
I'm reading data from one CRM instance, stripping out values and using an upsertrequest
to write to another CRM instance. Both CRM Instances have the same solution
installed so the customisations should be the same.
The system fields I'm stripping out include things like information regarding ownership, created on, modified on, etc. etc.
Because it is CRM Online, I can't figure out how to identify what the error is. For on-premise instances, you could figure this out via SQL profiling or examining CRM Trace Logs, but both of these options aren't applicable for CRM Online.
Does anyone have any advice?
// read the record from the Source environment
// columnSet_contact is a sub-set of columns excluding ownership details
var sourceContact = source.OrganizationServiceProxy.Retrieve
(
"contact",
contactid,
columnSet_contact
);
// Contact requires TransactionCurrencyID
sourceContact.Attributes["transactioncurrencyid"] = new EntityReference
(
"transactioncurrency",
targetEnvCurrencyId // id of Currency in target env retrieved previously
);
// write to target environment
target.OrganizationServiceProxy.Execute
(
new XrmMessages.UpsertRequest
{
Target = sourceContact
}
);