通过使用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 *必须作为帐户实体上的有效数字字段存在。     

要回复问题请先登录注册