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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Data Entity level - validateField

(0) ShareShare
ReportReport
Posted on by 680

Hi All,

In the context of data entity validation behavior, 

a back-end table-level validateField method validates AllowEdit and AllowEditOnCreate of the table fields .

Then, does a data entitiy-level validateField method validates AllowEdit and AllowEditOnCreate of an Entity field?

For the testing purpose, I have set an entity field's AllowEditOnCreate to No, and then passed the field and its value to this entity (from X++) with the expectation that the validation error occurs. 

However, there was no validation error at all and record was still created.

I also added a code like DataEntity.ValidateField(FieldIdtoCheck) in the mapEntityToDataSource method but the validation is passed (= return true) even if the above setting is configured and the field and its value were passed to the Entity.

Thank you.

I have the same question (0)
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    303,730 Super User 2026 Season 1 on at

    Hi ShawnDEV,

    When you are using x++ logic to fill a field, this would be possible. When you set AllowEditOnCreate to No, then there will be an error if a value is provided for the field in the source file.

  • Suggested answer
    nmaenpaa Profile Picture
    101,166 Moderator on at

    Hi ShawnDEV,

    I think that your initial assumption is not correct. ValidateField method of the table is run when a field is modified through user interface (form).

    On the other hand, AllowEdit and AllowEditOnCreate properties on fields determine if a field can be modified at all (again on a form).

    If AllowEdit is false, then the user can't edit a field on a form, except when creating it. And if AllowEditOnCreate is false, then the user can't edit the field even when creating a new record. Only if the user was allowed to edit a field, validateField method can and will be triggered, when the field is modified.

    When manipulating tables or entities via x++, AllowEdit/AllowEditOnCreate properties are ignored. You can always change field values via x++.

  • WillWU Profile Picture
    22,363 on at

    Hi ShawnDEV,

    Where did you put your codes to set the value?

    As Nikolaos said,  when the property is set to NO, users aren't allowed to modify the data for this field in a new record. But you could still create new record.

    What do you want to achieve here?

  • ShawnDEV Profile Picture
    680 on at

    Hi, I think your point is that table level ValidateField method is only triggered under the assumption that AllowEditOnCreate or AllowEdit field property is set to Yes.

    However, according to the following document,

    docs.microsoft.com/.../validations-defaults-unmapped-fields

    it is mentioned that

    "After the field values from the data entity are copied to mapped data source fields, field validations are run on the set fields. Validations include table-level validateField, which validates AllowEdit and AllowEditOnCreate."

    That's why I thought table-level validateField method includes validation of table field property check like AllowEdit and AllowEditOnCreate.

    Let me know if I misunderstood something.

    Thank you.

  • Suggested answer
    nmaenpaa Profile Picture
    101,166 Moderator on at

    That is only valid if you really import data into the system using the entity.

  • WillWU Profile Picture
    22,363 on at

    Hi ShawnDEV,

    Could you please tell us how you set the value of your field?

    Also please read:

    docs.microsoft.com/.../behavioral-properties-data-entities

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Shawn,

    You were right about table level and data entity level of AllowEdit and AllowEditOnCreate - they show different behaviour.

    Table level AllowEdit and AllowEditOnCreate is easy and we all know about that,

    Data entity level of AllowEditOnCreate will not import value of this field , when you add file into import job please pay attention to the warning message, it will say that field is AllowEditOnCreate No and will delete the mapping, so the imported record will have this field empty...

    If you want an error override insertDataSourceToEntity method and check it data entity field has any value  - if it has then add code Throw error("Value assigned ....")

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 658

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 468 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 333 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans