Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

assign the ownership of the contact to the team of the user who is creating the contact using plugin

$
0
0

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. 


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>