【问题标题】:Plugin dose not trigger on associate 1:N in CRM 2011插件不会在 CRM 2011 中的关联 1:N 上触发
【发布时间】:2014-01-27 08:39:50
【问题描述】:

我有两个系统实体:invoice 和 invicedetail。

在系统中存在关联 1:N - invoice_details(父:invoice,子:invoicedetail)。

我转到发票详细信息,然后转到产品部分 (invoicedetail) 并添加新产品。现在这个产品和发票是关联的,但我的插件没有触发;/

我在 associate 上注册了我的插件(插件注册工具中父子实体为空,执行为 POST-Operation)。

代码:

if(context.Message == "Associate")
{
    //but plugin not go here - it's not trigger on associate ;/
    if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is EntityReference)
    {
        entityRef = (EntityReference)context.InputParameters["Target"];
        entity = service.Retrieve("invoice", entityRef.Id, new Microsoft.Xrm.Sdk.Query.ColumnSet("invoiceid", "numberOfSomething"));
    }
    else
    {
        throw new Exception("excep");
    }
}

【问题讨论】:

    标签: plugins triggers crm associate


    【解决方案1】:

    我相信 associate 用于多对多。尝试在更新和创建 invoicedetail 时注册您的插件。您可能希望将过滤属性添加到更新中,以便仅在 invoicedetail 上的发票查找更改时触发。然后添加一个检查以仅在设置发票查找时执行您的逻辑。

    【讨论】:

    • 是的,但我也有在更新发票时触发的插件(但仅适用于 context.depth
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-20
    • 2012-06-22
    相关资源
    最近更新 更多