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, ...
Answered

Validation: Field 'Name' must be filled in

(2) ShareShare
ReportReport
Posted on by 172
Hi,

I'm inserting a record using DirPersonBaseEntity, but i'm getting this error:
Field 'Name' must be filled in.\nvalidateField failed on field 'DirPartyBaseEntity.Name'\n"
How to auto fill it by code?
   DirPersonBaseEntity dirPersonBaseEntity;

   dirPersonBaseEntity.PartyNumber                     = "123";
   dirPersonBaseEntity.FirstName                       = "aa";
   dirPersonBaseEntity.LastName                        = "bb";
   dirPersonBaseEntity.insert();
 
 
However, if i do the same but using DirPersonEntity, it works directly without filling Name and i think it's because of this mapping. What does this mapping do?
 
and what do in base entity to make it work?
Categories:
I have the same question (0)
  • Suggested answer
    Alireza Eshaghzadeh Profile Picture
    14,839 Super User 2026 Season 1 on at
    Hi,

    The keys are PartyNumber and ValidFrom. If either the first name, middle name, last name prefix, or last name has changed, the Name value must be rebuilt.

    Please try adding ValidFrom as part of the key. If that does not resolve the issue, rebuild the Name value accordingly.

  • Verified answer
    Martin Dráb Profile Picture
    239,035 Most Valuable Professional on at
    Name seems to be calculated in DirPersonBaseEntity.mapEntityToDataSource(). Debug the code to identify the difference between your two cases.
     
    Maybe you need to call initValue() of DirPersonBaseEntity.
  • CU22120935-0 Profile Picture
    172 on at
    • initValue fixed the issue directly but i don't know why it was needed for DirPersonBaseEntity and it wasn't needed for DirPersonEntiy
     
    • Regarding validFrom, i agree that i need to fill it, currently when i create a record, valid from is 1900, but when i update the record it's gets filled automatically with currentDateTime even though i didn't specify validFrom by code
      How to fill validFrom in case of insert by code? and how it's handled in update automatically?
     
    **regarding question duplication, i sent an email to the support team, not sure why my questions appear twice in the forum
  • Suggested answer
    Martin Dráb Profile Picture
    239,035 Most Valuable Professional on at
    If you debugged the code as I suggested, you'd have seen the difference.
     
    This is my assumption about what happened:
     
    If you look at the name calculation logic I mentioned, you'll notice that it depends on NameSequenceDisplayAs field. It's initialized in initValue() based on a parameter table. When DirPersonBaseEntity is used by DirPersonEntity, the system calls initValue() correctly. But when you used the entity from your code, you neither set NameSequenceDisplayAs field nor called initValue(), therefore NameSequenceDisplayAs wasn't specified and the name couldn't be calculated.
     
    Please don't forget to verify the answer.
  • CU22120935-0 Profile Picture
    172 on at
     
    I debugged the code, and yes initValue of DirPersonBaseEntity  gets called automatically when using DirPersonEntity, but if i will use DirPersonBaseEntity  then yes i need to call initValue explicitly.
     
    Thank you.
     
    I will verify the answer but can someone help with the validFrom point that @Alireza Eshaghzadeh mentioned?
    i will repeat what i found again:
     
    • Regarding validFrom, i agree that i need to fill it, but currently when i create a record, valid from is 1900 date, but when i update the record it's gets filled automatically with currentDateTime even though i didn't specify validFrom by code
      How to fill validFrom in case of insert by code? and how it's handled in update automatically?
       
    Because when we create the party manually, validFrom is filled, so the code should do the same somehow
  • Martin Dráb Profile Picture
    239,035 Most Valuable Professional on at
    Let's reiterate of what you've already found:
    1. Your problem wasn't related to ValidFrom field at all (so it's a bit off-topic here).
    2. It's not true that you need to fill in ValidFrom when creating new records.
    3. The value is maintained by F&O kernel (if you don't provide a value).
    If you want learn more about ValidFrom field and related logic, read Using date effective data pattern.

    If you have more questions about date-effective tables and entities, please create a new thread for them.
  • CU22120935-0 Profile Picture
    172 on at
    Hi Martin,

    i agree it's not related and i just created a new question
    DirPersonName ValidFrom is not filled automatically by code

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 659

#2
André Arnaud de Calavon Profile Picture

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

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 304 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans