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

Assign a role to a team with a Create plugin

$
0
0

Hi,

 

I want to deploy a Pre or Post Create plugin on the entity team.
The plugin must assign a role to the team.

I tried :

collectionReference.Add(new EntityReference("role", idRole));
_service.Associate(team.LogicalName, team.Id, new Relationship("teamroles_association"), collectionReference);

but i am getting a "Generic SQL Error"

I also tried to directly create the N:N association entity with :

Entity teamrole = new Entity();
teamrole.LogicalName = "teamroles";
teamrole["teamid"] = new EntityReference("team", team.Id);
teamrole["roleid"] = new EntityReference("role", idRole);
_service.Create(teamrole);

But then i get a The 'Create' method does not support entities of type 'teamroles'

Is there a way to assign the role at the creation of the team?

 

Thanks in advance

 

 


Viewing all articles
Browse latest Browse all 55831

Trending Articles



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