web
You’re offline. This is a read only version of the page.
close
Skip to main content
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
    RE: Is there a way to create a Business Process Error on an entity that prevents a user from creating more than 1 record?

    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
    RE: Is there a way to create a Business Process Error on an entity that prevents a user from creating more than 1 record?

    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,626 on at
    RE: Is there a way to create a Business Process Error on an entity that prevents a user from creating more than 1 record?

    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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
UllrSki Profile Picture

UllrSki 2

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans