Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

prevalidation or preoperation

(0) ShareShare
ReportReport
Posted on by

Hi,

I am writing a plugin for creating an account and check whether the account name already exists or not. if already exists, then we should not allow to create the account. My question is in plugin registration, which event pipeline we have to chose, prevalidation or preoperation ?

*This post is locked for comments

  • Suggested answer
    Michel Gueli Profile Picture
    982 on at
    RE: prevalidation or preoperation

    I'm not really convinced by the answers. Andrew has a good point.

    What the plugin needs to do is to check if the action is valid. Does the name already exists? If it exists, the action is not valid. The action can be done in the pre-validation. This is the most lightweight solution. There is no need to execute this logic within the database transaction. What is the benefit for this example? It is just a check.  

    If the action is valid (name is empty) and the process will continue, then all the normal validation, security checks will be done. I don't see any problems with that.

  • Nitin Meria Profile Picture
    216 on at
    RE: prevalidation or preoperation

    +1

  • Temmy Wahyu Raharjo Profile Picture
    2,914 on at
    RE: prevalidation or preoperation

    Hi. PreValidation on Msdn is not guarantee in transaction. So I'd prefer doing on PreOperation.

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: prevalidation or preoperation

    Hi Anand,

    In addition Andrew answer ,

    Few things need to be considered .

    As per MSDN the pre-validation stage occurs prior to security checks being performed to verify the calling or logged on user has correct permission to performed the intended operation.

    Secondly pre-validation occurs outside database transactions.

    Based on above two main criteria,, I would recommend to do this type of validation in the Pre-operation event  instead of pre-validation. As because creation of account should be require the security check .

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: prevalidation or preoperation

    Hello,

    You can use any of but it is safer to use PreOperation. In situation when Account is created from Lead during qualification PreValidation plugins are not triggered.

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans