0
votes

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 
    }
);
1

1 Answers

0
votes

Unfortunately there's no way to get more information from an online org without contacting MS support.

Do you get the same issue if you use Create/Update instead of Upsert? What about when the target environment is the same as the source environment?

I would also try modifying your logic so that everything but name gets excluded. The issue will probably go away...if it does, add in attribute by attribute until you find the one that causes the issue.