Just sharing a sample code that runs on the Activation of case (incident) record and updates one field in it.
We need to register the plugin in both SetState and SetStateDynamicEntity message. Interestingly what we found was the plugin runs perfectly even if it is registered only for SetStateDynamicEntity. It triggers properly either we update it from CRM UI or through the CRM SDK for SetStateDynamicEntity message.
protected override void ExecuteCrmPlugin(LocalPluginContext...