Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to set Default value to one of the fields in form group control using X++

(1) ShareShare
ReportReport
Posted on by

I am trying to customize 'Create new Customer record' form. Requirement is to set default values for some of the fields. One of the fields is part of field group from CustTable and is added as group control using X++. If it is a direct field, we can set as <FormFieldname>.value().

How can I set default value to one of the fields in the field group?

Appreciate any help on this.

*This post is locked for comments

  • 5400 Profile Picture
    7,162 on at
    RE: How to set Default value to one of the fields in form group control using X++

    Don't hardcode any value for initializing. Please check how the value is coming from customer parameters from as default.

    If you are hardcoding any value, functional people cannot be change if required in near future, so it will bound to technical person. Please provide some setup in parameters UI from where you can default.

    Like sale order Type.

    Please check \Forms\SalesCreateOrder\Data Sources\SalesTable\Methods\initValue method how it is mapped.

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: How to set Default value to one of the fields in form group control using X++

    Hi Swathi,

    Put it under initvalue() method so as to be called when creating a new record.

  • Martin Dráb Profile Picture
    234,615 Most Valuable Professional on at
    RE: How to set Default value to one of the fields in form group control using X++

    initValue() of the datasource would be a better place.

    Please close the thread my verifying the answer.

  • ShivamKotwalia Profile Picture
    on at
    RE: How to set Default value to one of the fields in form group control using X++

    Thanks Martin

    It worked .. one thing i wanted to mention was that if you want this to happen on opening of your form than place this code under the run method of your form and not on the init method of the form.

  • Suggested answer
    Martin Dráb Profile Picture
    234,615 Most Valuable Professional on at
    Re: How to set Default value to one of the fields in form group control using X++

    If a form control is bound to a table field, you should always work with the data source and not with the form control directly. It's not about the problem you have right now, but you can also have several controls for a single field and so on.

    The assignment is extremely simple - just use DatasourceName.FieldName, e.g. CustTable.DlvMode = 'ABC'.

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Kempeth Profile Picture

Kempeth 4

#1
Andy Adamak Profile Picture

Andy Adamak 4

#1
Community Member Profile Picture

Community Member 4

Featured topics

Product updates

Dynamics 365 release plans