Plugins 如何在crm 2011插件中分配记录后获取团队名称

Plugins 如何在crm 2011插件中分配记录后获取团队名称,plugins,dynamics-crm-2011,dynamics-crm,crm,dynamics-crm-2013,Plugins,Dynamics Crm 2011,Dynamics Crm,Crm,Dynamics Crm 2013,Aim:需要在指定记录后获取团队名称 说明:在联系人实体中,我将一个联系人分配给团队。团队名称为“ABC”。 我需要在插件中获取该团队名称“ABC”。该插件是在分配记录后触发的。后验证方法。如何获取分配的团队名称?如果插件消息为分配。您可以使用下面的代码获取指定的团队名称 if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is EntityReference)

Aim:需要在指定记录后获取团队名称

说明:在联系人实体中,我将一个联系人分配给团队。团队名称为“ABC”。

我需要在插件中获取该团队名称“ABC”。该插件是在分配记录后触发的。后验证方法。如何获取分配的团队名称?

如果插件消息为分配。您可以使用下面的代码获取指定的团队名称

if (context.InputParameters.Contains("Target") && 
context.InputParameters["Target"] is EntityReference)
{
EntityReference targetEntity = 
(EntityReference)context.InputParameters["Target"];

if (targetEntity.LogicalName != "contact")
{ return; }

if (context.InputParameters.Contains("Assignee"))
{
EntityReference assigneeRef =
(EntityReference)context.InputParameters["Assignee"];

if (assigneeRef.LogicalName == "team")
{
string assignName = assigneeRef.Name;//to retrieve assigned team name

}
}
}

如果插件消息为分配。您可以使用下面的代码获取指定的团队名称

if (context.InputParameters.Contains("Target") && 
context.InputParameters["Target"] is EntityReference)
{
EntityReference targetEntity = 
(EntityReference)context.InputParameters["Target"];

if (targetEntity.LogicalName != "contact")
{ return; }

if (context.InputParameters.Contains("Assignee"))
{
EntityReference assigneeRef =
(EntityReference)context.InputParameters["Assignee"];

if (assigneeRef.LogicalName == "team")
{
string assignName = assigneeRef.Name;//to retrieve assigned team name

}
}
}

插件应该在哪条消息上触发?插件应该在哪条消息上触发?我得到了null而不是teamname我得到了null而不是teamname。我像以下阶段事件阶段管道一样将插件注册为:Post-Operation.Execution mode:synchronous deployment:serverto retrieve team use service.retrieve方法get column namevarretrieve=service.retrieve(assigneeRef.LogicalName、assigneeRef.Id、新列集(“名称”);string getTeamName=Convert.ToString(retrieve.Attributes[“name]”);你得到那个名字了吗?我得到了null而不是teamname我得到了null而不是teamname。我将插件注册为如下阶段事件阶段管线:Post-Operation.Execution mode:synchronous deployment:serverto retrieve team use service.retrieve方法get column namevar retrieve=service.retrieve(assigneeRef.LogicalName,assigneeRef.Id,new ColumnSet(“name”);string getTeamName=Convert.ToString(retrieve.Attributes[“name”);您得到那个名称了吗?