Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

InvalidPluginExecutionExeception and Auto Save in CRM 2013

$
0
0

Hello Experts,

I have a Post update plugin which triggers and checks for a pickist attribute value on the entity and performs some operation. For a particular value of the picklist attribute I just need to rollback the operation without doing anything. For rolling back I am throwing an exception with an error message.

The code is something as below.

if (((OptionSetValue)(entity.Attributes["picklist"])).Value == 100000001)
{
   //do something here
}
else if(((OptionSetValue)(entity.Attributes["picklist"])).Value == 100000002) 
{ 
throw new InvalidPluginExecutionException(OperationStatus.Failed,"Not a valid operation for this value");
}

Expectation - My expectation is that when the operation is tried with value 10000002, the error message should be prompted to the user and the update should be rolled back.

Actual - The user is getting the error message prompt, but the form is remaining in the unsaved state. Thus, it is getting triggered after every 10 sec (auto save) and throwing the same error. The only way to get out of this loop is to refresh the browser window or to change the picklist value to 100000001 which is not what I intent.

Anyone facing similar issue? Any workaround?

Thanks,

Swaroop


Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>