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)

Is there a way to create a Business Process Error on an entity that prevents a user from creating more than 1 record?

(0) ShareShare
ReportReport
Posted on by

I have a custom entity with fields, which is customized. However, I want to write a plugin in such a way that when a user creates more than 1 record, it generates a Business Process Error saying they cannot create more than 1 record. Is there a way to achieve this?

In other words, they can create 1 record within D365, but when they try to create a new record, it generates the error. Additionally, they have the option to update the current record they had created. 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Arun Vinoth Profile Picture
    11,615 Moderator on at

    You have to write a pre-create plugin, in which retrieve the count of existing records using fetchxml. If the count is equal to 1, then throw new InvalidPluginExecutionException.

    This will throw Business Process error to user & rollback, so 2nd record won’t be created, but they can update as usual.

  • Suggested answer
    Pawar Pravin  Profile Picture
    5,237 on at

    Hi ,

    Agree with Arun for plugin approach. Please do create plugin on pre create operation.

    Inside plugin check no of records kind of logic using either query expression or fetch expression.

    If found then through exception.

    Regards,

    Pravin

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at

    Hi,

    if the checking is not complex, real time workflow can achieve that too.

    survivingcrm.com/.../using-real-time-workflows-to-show-error-messages

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