Hi, Readers.
Today I would like to talk briefly about the red asterisk next to a field in Business Central.
When you enter data, you might see a red asterisk next to a field. The asterisk means that the field is required for a certain process. For example, on the Customer Card page, the red asterisk appears in the Name field and in the posting group fields to indicate that you can’t post a sales transaction for the customer unless the fields are filled.
Let me look at another example, on the Item Card page, the red asterisk appears in the Description field and in the posting group fields to indicate that you can’t enter the item on a document line, such as a sales order, unless this field is filled.
And put the mouse on the red asterisk and you can see the following message:
The value for this field is required.
I am often asked a question about fields that are marked with a red asterisk, but users can save data without filling it out. Why???
This is mentioned in the Microsoft learn (MS Docs), more details: Detecting Mandatory Fields
The visual clue doesn’t force you to fill in the field. The red asterisk is a reminder that you’re blocked from completing a process.
Yes, in Business Central, the red asterisk is just a reminder and not a real required field like in other systems. This is added via the ShowMandatory Property and NotBlank Property (Only for primary fields). For example,
This also works in custom tables and fields.
So, can a user make fields mandatory at will? Unfortunately, until now in Business Central to make fields mandatory needs development. For example,
1. Using Record.TestField(Any, Code) Method
2. Using NotBlank Property: You can use this property together with the InitValue Property to make sure that an entry is made in this field. This setting is evaluated for controls and fields during validation. Validation occurs only if the field or control value is updated through the UI, for example, if a value is updated on a page or if a field is updated in a table directly. If a field is updated through application code, then the NotBlank property is not validated.
More details: Dynamics 365 Business Central: How to make a field mandatory
So please remember, this is just a reminder and not a real required field, and it’s good to tell your customers during the testing phase.
END
Hope this will help.
Thanks for reading.
ZHU
コメント