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 AX (Archived)

Validation for uniqueness on table records when inserting

(0) ShareShare
ReportReport
Posted on by

Hi there,

  I have created a table containing the following fields:

i) Status                            (enum value)

ii) Organization                (boolean)

iii) Department                 (boolean)

iv) Team                            (boolean)

  I then created a grid based on this table.  I used all of the fields.  The fields are displayed in the following way in the grid:

i) Status                            (Combobox)

ii) Organization                (Checkbox)

iii) Department                 (Checkbox)

iv) Team                           (Checkbox)

  Now, I want that the user selects a status and ticks the relevant checkboxes to either apply it on organization, department or team.  I want the following conditions:

i) When creating an entry, the user must select a status and at least tick one checkbox.

ii) Instead of creating one entry and tick multiple checkboxes for the same status, the user can create multiple entries with the same status and tick the checkboxes individually.

iii) If a checkbox was selected in one entry for that status, it cannot be selected in another entry for that status.

To achieve the above, I created an index with all the 4 fields in it and specified the property AllowDuplicaties to no.

However, the following is still allowed since, for the application, the two records are different:

Status Organization Department Unit
Refunded X
Refunded X X

I want the application to stop the user from inserting the second record since the Organization checkbox was already ticket in the first entry.  How can I do this please?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Jonathan  Halland Profile Picture
    11,310 on at
    RE: Validation for uniqueness on table records when inserting

    Hi.

    I would recommend writing your logic into your validateWrite method on your table (or form datasource). Other wise you will need to create a large amount of unique indexs to handle the various combinations.

  • Community Member Profile Picture
    on at
    RE: Validation for uniqueness on table records when inserting

    Thank you for your answer Jonathan.  I appreciate it immensely.

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 AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

#2
NNaumenko Profile Picture

NNaumenko 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans