![](/img/trans.png)
[英]Dynamics CRM 2011: javascript, 'null' is null not an object. error
[英]Dynamics Crm 2011 error while registering the plugin
我完全不熟悉crm 2011的這個插件部分。
我寫了一個簡單的plugin.Generate一個xrm.cs文件並嘗試注冊該插件,但它給出了一些“超時異常”。后來,我從解決方案中刪除了Xrm.cs文件,然后該插件被注冊了。 我不明白為什么會這樣。
以下是我的簡單插件代碼,由於我刪除了Xrm.cs文件,因此未被調用。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using Microsoft.Xrm.Sdk;
using System.Runtime.Serialization;
namespace NewPlugin
{
public class Plugin : IPlugin
{
/// <summary>
/// A plugin that creates a follow-up task activity when a new account is created.
/// </summary>
/// <remarks>Register this plug-in on the Create message, account entity,
/// and asynchronous mode.
/// </remarks>
public void Execute(IServiceProvider serviceProvider)
{
//Extract the tracing service for use in debugging sandboxed plug-ins.
ITracingService tracingService =
(ITracingService)serviceProvider.GetService(typeof(ITracingService));
account
// Obtain the execution context from the service provider.
IPluginExecutionContext context = (IPluginExecutionContext)
serviceProvider.GetService(typeof(IPluginExecutionContext));
// The InputParameters collection contains all the data passed in the message request.
if (context.InputParameters.Contains("Target") &&
context.InputParameters["Target"] is Entity)
{
// Obtain the target entity from the input parameters.
Entity entity = (Entity)context.InputParameters["Target"];
throw new InvalidPluginExecutionException("not Possible");
}
}
}
}
如果有人可以告訴我Xrm.cs文件出了什么問題,那將有很大幫助。
這是我在帳戶頁面上單擊創建按鈕的onclick例外
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: An error occurred. Contact a system administrator or refer to the Microsoft Dynamics CRM SDK troubleshooting guide.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>
</ErrorDetails>
<Message>An error occurred. Contact a system administrator or refer to the Microsoft Dynamics CRM SDK troubleshooting guide.</Message>
<Timestamp>2013-10-28T04:51:39.2540481Z</Timestamp>
<InnerFault i:nil="true" />
<TraceText>
[ActivityFeeds.Plugins: ActivityFeeds.Plugins.ActivityClose]
[34685442-783d-e311-a318-b4b52f6727c4: ActivityFeeds.Plugins.ActivityClose: Create of account]
可能您不是Deployment Manager(可以在crm org manager中檢查它),並且該插件未在隔離模式下注冊。 您可以嘗試將crm開發人員工具箱安裝在sdk(SDK \\ Tools \\ DeveloperToolkit)中,以簡化部署/注冊。 這將允許使用包,插件項目創建新的解決方案,並且如果連接到正確的crm和解決方案,您將能夠讓VS為您創建基類。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.