通过使用Microsoft Dynamics CRM中的插件,将数字值添加到帐户实体的销售代表属性中

问题描述

| 之后,我在类库中编写了代码,然后构建了代码并将代码复制到
C:\\Program Files\\Microsoft Dynamics CRM\\Server\\bin\\assembly
我试图模拟工作。它没有填充表单中的值。 谁能帮我解决这个问题?
public void Execute(IPluginExecutionContext context)
{
    DynamicEntity entity = null;

    if (context.InputParameters.Properties.Contains(\"Target\") &&
        context.InputParameters.Properties[\"Target\"] is DynamicEntity)
    {
        entity = (DynamicEntity)context.InputParameters.Properties[\"Target\"];
        if (entity.Name != EntityName.account.ToString()) { return; }
    }
    else
    {
        return;
    }

    try
    {
        // DynamicEntity followup = new DynamicEntity();
        CrmNumber gcs_numb = new CrmNumber();
        gcs_numb.Value = 10;
        //follow.Properties = new PropertyCollection();
        entity.Properties.Add(new CrmNumberProperty(\"gcs_numberofsalesreps\",gcs_numb));
    }
    catch (System.Web.Services.Protocols.soapException ex)
    {
        throw new InvalidpluginExecutionException(
                \"An error occurred in the Account plug-in.\",ex);
    }
}
    

解决方法

        可能有很多事情,我希望提供更多信息: 您是如何注册插件的?通常,您希望在预事件即Create上同步注册它。使用插件注册工具 您是否要取消对ICrmService.Update的呼叫?
ICrmService service = context.CreateCrmService(true);
service.Update(entity);
您是否创建了自定义字段并正确发布了它们? * gcs_numberofsalesreps *必须作为帐户实体上的有效数字字段存在。     

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...