未处理的异常:Microsoft.Crm.CrmException:找不到要更改状态的记录

时间:2016-10-19 07:04:22

标签: dynamics-crm

是否有人在未处理的异常之前解决了此错误:Microsoft.Crm.CrmException:找不到要更改状态的记录

以下代码中发生错误。 设置状态工作流操作也会发生错误。

 Guid jobCode = _generalLedger.FindJobCode(importRecord.sms_jobcode); 
 Guid chartOfAccounts = _generalLedger.FindChartOfAccountName(importRecord.sms_chartofaccountcode); 

 var ft = sms_financialtransaction()
 {
            sms_date = DateTime.ParseExact(importRecord.sms_datepaid, _dateFormats, null, DateTimeStyles.None),
            sms_EventId = new EntityReference(sms_event.EntityLogicalName, eventId),
            sms_totalamount = new Money(decimal.Parse(importRecord.sms_amountdonated)),
            sms_fullnameid = new EntityReference(Contact.EntityLogicalName, contactId),
            sms_jobnumberid = new EntityReference(sms_job.EntityLogicalName, jobCode),
            sms_chartofaccountid = new EntityReference(sms_chartofaccount.EntityLogicalName, chartOfAccounts),
            sms_source = new OptionSetValue((int)sms_financialtransactionsms_source.RoyalLifeSaving),
            statuscode = new OptionSetValue((int)sms_financialtransaction_statuscode.Completed)
 };

_serviceContext.AddObject(ft);
_serviceContext.SaveChanges();

0 个答案:

没有答案