web
You’re offline. This is a read only version of the page.
close
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

I have the same question (0)
  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    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.

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    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 .

  • Temmy Wahyu Raharjo Profile Picture
    2,916 on at

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

  • Nitin Meria Profile Picture
    216 on at

    +1

  • Suggested answer
    Michel Gueli Profile Picture
    982 on at

    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.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans