User
User

Reputation: 1662

How to get team name after record assigned in crm 2011 Plugin

Aim: need to get team name after assigned Record.

Description: In contact Entity,I assign one Contact to team. The team name is "ABC".
I need to get that team name "ABC" in Plugin.The plugin was triggered After the record was assigned.Post-validation method.How can I get the Assigned team Name?

Upvotes: 0

Views: 835

Answers (1)

Srinivas Hsk
Srinivas Hsk

Reputation: 398

If the Plugin Message is Assign. You Can Use the below Code to get the 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

}
}
}

Upvotes: 4

Related Questions