2016-12-28 64 views
-1

插件預操作碼內的代碼時,看起來是這樣的:前運期間「業務流程錯誤」試圖創建一個實體

var cloneEntity = new Entity(SPLIT_SAVINGS); 
object endDate; 
_parentEntity.Attributes.TryGetValue(END_DATE, out endDate); 

cloneEntity.Attributes[START_DATE] = _parentEntity.Attributes[START_DATE]; 
cloneEntity.Attributes[END_DATE] = endDate; 
cloneEntity.Attributes[RATIO] = _parentEntity.Attributes[RATIO]; 
Guid cloneId = service.Create(cloneEntity); 

所以我想要做的是,從創建這個實體,它也會克隆自己(相同的日期和比率屬性)與另一個相關實體相關聯。我不知道該怎麼製作錯誤日誌。我唯一能做的就是錯誤代碼,我找不到任何關於它的信息。

這是否與Create()調用再次遞歸執行pre-op這一事實有關?我已經有了防止無限循環的條件邏輯。

這裏是錯誤日誌以供參考。謝謝。

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: There was an error in the Plugin CRMPluginSolution.Plugins.SplitSavingsRatioProcess, and a log has been created. Please try this again later. If this issue persists contact your IT Staff. Detail: 
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts"> 
    <ErrorCode>-2147220891</ErrorCode> 
    <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic"> 
    <KeyValuePairOfstringanyType> 
     <d2p1:key>OperationStatus</d2p1:key> 
     <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">0</d2p1:value> 
    </KeyValuePairOfstringanyType> 
    <KeyValuePairOfstringanyType> 
     <d2p1:key>SubErrorCode</d2p1:key> 
     <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">-2146233088</d2p1:value> 
    </KeyValuePairOfstringanyType> 
    </ErrorDetails> 
    <Message>There was an error in the Plugin CRMPluginSolution.Plugins.SplitSavingsRatioProcess, and a log has been created. Please try this again later. If this issue persists contact your IT Staff. </Message> 
    <Timestamp>2016-12-28T23:42:10.5503562Z</Timestamp> 
    <InnerFault i:nil="true" /> 
    <TraceText> 

[CRMPluginSolution.Plugins: CRMPluginSolution.Plugins.SplitSavingsRatioProcess] 
[77dfca7a-35cd-e611-80df-00059a3c7a00: SplitSavingsRatioProcess] 


</TraceText> 
</OrganizationServiceFault> 

回答

0

發現問題。我的插件註冊工具的配置文件被設置爲在創建調用時拋出異常,所以它永遠不會超過這個。一旦我將探查器設置爲使用持久性,實體就會被創建。