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 :
Finance | Project Operations, Human Resources, ...
Answered

Enforce uniqueness without table extension and index

(0) ShareShare
ReportReport
Posted on by 235

Hello,

I have a development requirement for D365 F&O on the SalesCreateOrder form.  When order entry occurs, they would like to enforce that the same customer account (SalesTable.Custaccount) does not use the same customer requisition (SalesTable.PurchOrderFormNum) in the system.  My solution is to have a formDataFieldEventHandler on the PurchOrderFormNum and check for duplicates OnValidating.  This works fine, but it does not enforce the duplicate from being written.  I can do the same thing on FormDataSourceEventHandler, OnValidatingWrite but again, it's not enforcing the write.  I was about to create a table extension with an index to enforce the uniqueness on Custaccount and PurchOrderFormNum, but Microsoft warns this will not be supported in future releases.

What can I do to enforce that the form will not allow the write?

Thanks,

Steve

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    You're claiming that you want to enforce writing, but I think you want the oposite: to prevent the record from being saved to database.

    If your code in the event handler of OnValidating doesn't do this job, the likely explanation is that you forgot to set the validation result to false. Please review your code and share it with us if needed.

  • Suggested answer
    TheGoodDBA Profile Picture
    235 on at

    That was it exactly.

    Thank you for the suggestion.

    Steve

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans