Bhubaneswar, Odisha, India
+91-8328865778
support@softchief.com

Prevalidation v/s PreOpration in Dynamics 365

Prevalidation v/s PreOpration in Dynamics 365

In Dynamics 365, Pre-Validation and Pre-Operation stages are both Pre-events which occurs before the core operation. But there is significance differences between them which will give you points to decide when to use Pre-validation and When to use Pre-Operation.

Dialog to register a step
Pre-ValidationPre-Operation
Pre-validation stage executes outside Database Transaction which will not rollback the entire operations written in the plugin if there is any runtime error occurs in one operation. This provides an opportunity to include logic to cancel the operation before the database transaction.Pre-Operation stage executes inside database transaction due to which any runtime error occurs in a single operation in the plugin will rollback entire operations which are part of the plugin.
If you want to change any values for an entity included in the message, you should do it here.
This stage occurs before any security checks are preformed to verify that the calling or logged-on user has the correct permission to perform the intended operation.This stage involves security checks to verify that the calling user has correct permission to perform the intended operation.
Example: Check duplicate records created by a particular team and restricts record creation else create records.Example: Debit Amount from one record and credit in another record.
Stage : 10Stage : 20
Pre-Validation V/S Pre-Operation

NOTE : Avoid cancelling an operation in Pre-Operation. Canceling will trigger a rollback of the transaction and have significant performance impact.