Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Pre-validation, pre- operation, post-operation stages

(0) ShareShare
ReportReport
Posted on by

Hi All,

Can you please help me understand all this stages with some simple example for each.

Thanks

*This post is locked for comments

  • Piotr Kalwasinski Profile Picture
    Piotr Kalwasinski 240 on at
    RE: Pre-validation, pre- operation, post-operation stages

    Hi Sam,

    The pipeline is nicely explained in below MS doc:

    docs.microsoft.com/.../gg327941(v=crm.8)

    I hope this helps,

    Piotr

  • Saddamk206 Profile Picture
    Saddamk206 777 on at
    RE: Pre-validation, pre- operation, post-operation stages

    Pipeline stages:-

    1. Pre-Validation

    2. Pre-Operation

    3. MainOperation

    4. Post-Operation

    1. Pre-Validation:- security checks being performed to verify the calling or logged on user has the correct permissions to perform the intended operation.

    2. Pre-Operation:- execute before the main system operation. Plug-ins registered in this stage are executed within the database transaction.

    3. MainOperation:- main operation of the system, such as create, update, delete, and so on. No custom plug-ins can be registered in this stage.

    4. Post-Operation :- plug-ins which are to execute after the main operation. Plug-ins registered in this stage are executed within the database transaction.

     

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Pre-validation, pre- operation, post-operation stages

    Do you have any experience with "Create" plugins using optimistic concurrency?  It appears that even though the plugin is post-operation, the record creation is canceled when an optimistic concurrency violation exception occurs (even when handled in a try/catch).  This wasn't the case with Dynamics 2016 on-premise, but it seems the behavior changed with 365 online.  The point is, the event pipeline changed between Dynamics version, but it doesn't seem to be documented anywhere.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Pre-validation, pre- operation, post-operation stages

    Hi Sherif. Nice explanation. Simple and clear

  • Saddamk206 Profile Picture
    Saddamk206 777 on at
    RE: Pre-validation, pre- operation, post-operation stages

    Event Pipeline (Pre-validation, pre- operation, post-operation stages)

    Pre- validation:-   means your plugin will run before the form is validated.

    Example uses:

    Some “delete” plug-ins. Deletion cascades happen prior to pre-operation, therefore if you need any information about the child records, the delete plugin must be pre-validation.

    Pre- operation:-   is after validation and before the values are saved to the database.

    Example uses:

    If and “update” plug-in should update the same record, it is best practice to use the pre-operation stage and modify the properties. That way the plug-in update is done within same DB transaction without needing additional web service update call.

    Post- operation:-  is your plugin will run after the values have been inserted or changed on the database.

    Example uses:

    Most of the “Create” plugins are post-event. This allows access to the created GUID and creation of relationships to newly created record.

  • Aileen Gusni Profile Picture
    Aileen Gusni 44,524 on at
    RE: Pre-validation, pre- operation, post-operation stages

    Hi Sam,

    In real-life, imagine you are trying to apply ID card as new employee

    First, the status = Submitted

    a. Pre-Validation: the HR will ask you many validation, like required documents, such as your first name info, your National ID Card, check your employee info, check your first name last name correct or not, it is like checking the attribute validation or check other related info

    b. Pre-Operation: Validation success, then the HR is going to process another step.

    Then you have logic to add the status: Approved, add the HR Officer Name as Reviewed by "Ms HR".

    You need to add this information before the ID Card is created, imagine this is record has not been saved/created yet. It is just about to be created.

    c. Post-Operation: Validation Success, Pre-Operation no problem, all the info required is captured..Then what's next?

    The ID Card is created then the system will Create Notification by sending email, then your next action is you will come to get it, then you will actually try this card whether you can access or not.

    Thank you.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Pre-validation, pre- operation, post-operation stages

    Hello Sam,

    Pre- validation means your plugin will run before the form is validated.

    Pre- operation is after validation and before the values are saved to the database.

    Post- operation is your plugin will run after the values have been inserted or changed on the database.

    This link clearly describes about each stages with simple examples  :
    http://crmbook.powerobjects.com/extending-crm/plug-in-development-and-workflow-extensions/plug-ins/event-pipeline/

    Hope this helps you :) Thanks

  • Verified answer
    Aileen Gusni Profile Picture
    Aileen Gusni 44,524 on at
    RE: Pre-validation, pre- operation, post-operation stages

    Hi Sam,

    I believe you have read links from the internet.

    Here maybe explanation that can help you:

    *If we talk about Create as example

    1. Pre-Validation: is before the record even reaching the stage of pre-operation, so means not yet saved, it is the first layer, usually used for validation, but not many people use this, usually will just use pre-operation.

    2. Pre-Operation: is also before the record created, not yet database transaction committed.

    This is usually used to modify attribute value by system (logic code), validation as well.

    Any changes of attribute in the pre-validation would be dismissed if you modify the attribute from this stage.

    Since mentioned before, this is not yet created, so, there is no ID created at this point.

    3. Post-Operation: is after the record created, database transaction committed, and you would get the GUID.

    You cant change the value of the record in this stage since already committed, but you can take next action, what's next you do for this record or another action.

    Example: Want to assign this record to another owner (reason why you put on Post is because you need GUID), share to another team, send email as notification, create task or anything you need reference to this record, because you need this record created first.

  • Suggested answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,074 on at
    RE: Pre-validation, pre- operation, post-operation stages

    Hi Sam,

    Read this blog. Hope it helps you to understand the concepts clearly.

    https://community.dynamics.com/crm/b/crmeventexecutionpipeline/archive/2016/03/15/microsoft-dynamics-event-execution-pipeline

    Thanks

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: Pre-validation, pre- operation, post-operation stages

    Please read this article, it does provide example.

    crmbook.powerobjects.com/.../event-pipeline

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,622 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,354 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans