Answered by:
plugin on case activate and deactivate

Question
-
Dear All;
i have a plugin on case entity on its update event that works fine but when i deactivate it and activate it again it gives me error i dont want to run my plugin only if it is acttive not on another states of the record please help
Thursday, June 14, 2012 9:56 AM
Answers
-
Hi,
In your Update Step of Plugin remove statecode attribute from Filtering Attribute list.
Suresh
- Marked as answer by anwar_addi Friday, July 13, 2012 1:05 PM
Monday, June 18, 2012 1:25 PM -
Hi anwar_addi,
Inside your plugin, you will need to check to make sure that it is running on the correct event (eg: Update event only).
var context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext)); if (context.MessageName == "Update") { // Do your update logic here }
That way, your plugin logic will only get triggered on Update message only.
Also make sure that you registered your plugin steps only for Update message.
I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful.
Dimaz Pramudya | CSG (Melbourne) | http://www.xrmbits.com | dimaz@xrmbits.com If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"
- Proposed as answer by Dimaz Pramudya (www.xrmbits.com) Monday, June 18, 2012 11:29 PM
- Edited by Dimaz Pramudya (www.xrmbits.com) Monday, June 18, 2012 11:36 PM
- Marked as answer by anwar_addi Friday, July 13, 2012 1:05 PM
Monday, June 18, 2012 11:29 PM
All replies
-
Hi,
In your Update Step of Plugin remove statecode attribute from Filtering Attribute list.
Suresh
- Marked as answer by anwar_addi Friday, July 13, 2012 1:05 PM
Monday, June 18, 2012 1:25 PM -
Hi anwar_addi,
Inside your plugin, you will need to check to make sure that it is running on the correct event (eg: Update event only).
var context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext)); if (context.MessageName == "Update") { // Do your update logic here }
That way, your plugin logic will only get triggered on Update message only.
Also make sure that you registered your plugin steps only for Update message.
I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful.
Dimaz Pramudya | CSG (Melbourne) | http://www.xrmbits.com | dimaz@xrmbits.com If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"
- Proposed as answer by Dimaz Pramudya (www.xrmbits.com) Monday, June 18, 2012 11:29 PM
- Edited by Dimaz Pramudya (www.xrmbits.com) Monday, June 18, 2012 11:36 PM
- Marked as answer by anwar_addi Friday, July 13, 2012 1:05 PM
Monday, June 18, 2012 11:29 PM