Hi all,
In this blog post I will give the code to obtain the required details in a plugin that triggers on adding and removing members from access team. Please refer here for details on the properties that come as part of the input parameters.
Here is the step configuration (that will go to the CRM register file):
<Step CustomConfiguration="" Name="PostTeamtemplateAddUserToRecordTeam" Description="Post-Operation of Team template AddUserToRecordTeam" Id="71b99ae3-488c-e611-80d5-000d3aa06eb4" MessageName="AddUserToRecordTeam" Mode="Asynchronous" PrimaryEntityName="teamtemplate" Rank="1" SecureConfiguration="" Stage="PostOutsideTransaction" SupportedDeployment="ServerOnly">
<Images />
</Step>
<Step CustomConfiguration="" Name="PostTeamtemplateRemoveUserFromRecordTeam" Description="Post-Operation of Team template RemoveUserFromRecordTeam" Id="c71676f2-488c-e611-80d5-000d3aa06eb4" MessageName="RemoveUserFromRecordTeam" Mode="Asynchronous" PrimaryEntityName="teamtemplate" Rank="1" SecureConfiguration="" Stage="PostOutsideTransaction" SupportedDeployment="ServerOnly">
<Images />
</Step>
As can be seen from above, the primary entity for the plugin is the "TeamTemplate" entity.
The plugin code will look like the below:
if (context.MessageName == "AddUserToRecordTeam" || context.MessageName == "RemoveUserFromRecordTeam")
{
EntityReference dealEntityRef = null;
if ((context.InputParameters.Contains("Record") && context.InputParameters["Record"] is EntityReference))
{
var recordEntityRef = (EntityReference)context.InputParameters["Record"];
if (recordEntityRef.LogicalName == "opportunity")
{
dealEntityRef = recordEntityRef;
}
}
if (dealEntityRef != null)
{
// do logic here
}
}
Here, I have only considered the "Record" input parameter but you can also consider the SystemUserId, TeamTemplateId parameters as required in your logic.
Let me know if you have any questions!
Happy CRMing!
In this blog post I will give the code to obtain the required details in a plugin that triggers on adding and removing members from access team. Please refer here for details on the properties that come as part of the input parameters.
Here is the step configuration (that will go to the CRM register file):
<Step CustomConfiguration="" Name="PostTeamtemplateAddUserToRecordTeam" Description="Post-Operation of Team template AddUserToRecordTeam" Id="71b99ae3-488c-e611-80d5-000d3aa06eb4" MessageName="AddUserToRecordTeam" Mode="Asynchronous" PrimaryEntityName="teamtemplate" Rank="1" SecureConfiguration="" Stage="PostOutsideTransaction" SupportedDeployment="ServerOnly">
<Images />
</Step>
<Step CustomConfiguration="" Name="PostTeamtemplateRemoveUserFromRecordTeam" Description="Post-Operation of Team template RemoveUserFromRecordTeam" Id="c71676f2-488c-e611-80d5-000d3aa06eb4" MessageName="RemoveUserFromRecordTeam" Mode="Asynchronous" PrimaryEntityName="teamtemplate" Rank="1" SecureConfiguration="" Stage="PostOutsideTransaction" SupportedDeployment="ServerOnly">
<Images />
</Step>
As can be seen from above, the primary entity for the plugin is the "TeamTemplate" entity.
The plugin code will look like the below:
if (context.MessageName == "AddUserToRecordTeam" || context.MessageName == "RemoveUserFromRecordTeam")
{
EntityReference dealEntityRef = null;
if ((context.InputParameters.Contains("Record") && context.InputParameters["Record"] is EntityReference))
{
var recordEntityRef = (EntityReference)context.InputParameters["Record"];
if (recordEntityRef.LogicalName == "opportunity")
{
dealEntityRef = recordEntityRef;
}
}
if (dealEntityRef != null)
{
// do logic here
}
}
Here, I have only considered the "Record" input parameter but you can also consider the SystemUserId, TeamTemplateId parameters as required in your logic.
Let me know if you have any questions!
Happy CRMing!
No comments:
Post a Comment