web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans