Tuesday, August 4, 2015

How to make unique field validation in dynamics ax form

If you need to make a form field unique, what you would need to do is to add a unique index to the table that is associated with DATASOURCE in the dynamics ax form. Here for example, I have student department and what I require is to make the student department's id unique.

1. My first step would to create an index in Indexes section of StudentDepartment table and then I would simply drap and drop StdDepartmentId field of of the table to that particular index.


2. Next thing I am going to do is to mark the AllowDuplicates property of that index to No.



Now when I am going to enter the duplicate department id, I am unable to see any record duplication error which I was expecting. What basically the issue here is to make a field unique, I would have to mark that particular filed mandatory too. So I would also perform one more step here.

3. Go to field section of the StudentDepartment table. Check the properties of StdDepartmentId and mark the "Mandatory" property to "Yes".

Now when I would try to enter a duplicate record, I would be able to see this error message.



Some times you are stuck at very small things in AX, so make sure you are doing all important things.

1 comment: