Announcements
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
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.
Hi Swathi,
Put it under initvalue() method so as to be called when creating a new record.
initValue() of the datasource would be a better place.
Please close the thread my verifying the answer.
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.
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'.
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156