I have two system entities: invoice and invicedetail.
In system exist association 1:N - invoice_details (parent: invoice, child: invoicedetail).
I go to invoice details, next go to Products section (invoicedetail) and add new product. Now this product and invoice is associate but my plugin not triggered ;/
I registered my plugin on associate (parent and child entity are empty in plugin registration tool, execution is POST-Operation).
Code:
if(context.Message == "Associate")
{
//but plugin not go here - it's not trigger on associate ;/
if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is EntityReference)
{
entityRef = (EntityReference)context.InputParameters["Target"];
entity = service.Retrieve("invoice", entityRef.Id, new Microsoft.Xrm.Sdk.Query.ColumnSet("invoiceid", "numberOfSomething"));
}
else
{
throw new Exception("excep");
}
}