public bool ValidateContactAssignmentRelationship(IPluginExecutionContext context, ITracingService tracingService, out EntityReference contact, out EntityReference assignment)
{
contact = null;
assignment = null;
if (!(context.InputParameters["Relationship"] is Relationship rel) ||
!string.Equals(rel.SchemaName, "tt_Contact_tt_Assignment", StringComparison.OrdinalIgnoreCase))
{
return false;
}
if (!(context.InputParameters["Target"] is EntityReference target) ||
!(context.InputParameters["RelatedEntities"] is EntityReferenceCollection related) ||
related.Count == 0)
{
tracingService.Trace("Missing Target or RelatedEntities parameters");
return false;
}
if (target.LogicalName != "contact" || related[0].LogicalName != "tt_assignment")
{
tracingService.Trace("Entity type mismatch");
return false;
}
contact = target;
assignment = related[0];
return true;
}