Hi i have the following requirement. i am new to plugins.
"When a new contact is created from CRM, automatically assign the ownership of the contact to the team of the user who is creating the contact"
I am not sure how to find the team using the owner field and set the team to the contact. could you please advise me? thank you, Siva
public class updateOwnership : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
var context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
var entity = context.InputParameters["Target"] as Entity;
if (entity.LogicalName != "contact")
return;
var owner = entity.GetAttributeValue<String>("ownerid");
}
}
These are few sample teams.