Hello,
On Case (Incident) entity we have Task records associated with it (via 1:N relationship). We have the default 'Cascade-All' behavior in said relationship, so that each time a Case is assigned a different owner, all of its Tasks are also assigned that owner.
We'd like to perform some business logic whenever a Task changes ownership. It can happen in two ways - the first via manually assigning the Task record to a different owner, and the second via assigning the Case to a different owner thus assigning the Task (via 'Cascade-All').
We have registered a plug-in on Assign message on Task entity and it works well when a Task is manually assigned a different owner. However, when the Case is assigned, and thus assigning its Tasks, the plug-in does not get triggered.
We have read that CRM treats Cascade-Assign operations as Update, rather than Assign. So we also registered a plug-in on Update message on Task. However, when we registered it in Pre-Operation, the Target entity did contain the ownerid, but with its old value, instead of its new value.
Why does CRM keep the old value of ownerid in Target entity, when plug-in is registered in Update Pre-Operation and when used during 'Cascade-All' action? The Update Pre-Operation works well again when the Task itself updates.
What we ended up doing is registering the Task plug-in in Update Post-Operation and taking the ownerid value from Post-Image instead of the Target since it contained the old value.