Today I would like to talk about how to enter any value in a TableRelation field (Without validating the table relationship).
As you might know, the TableRelation property lets you establish lookups into other tables. For example, on the sales order, you can select a customer from the customer table. This is done through a table relationship.
When the value you enter does not exist in the related table, there will be an error.
The field Sell-to Customer No. of table Sales Header contains a value (10099) that cannot be found in the related table (Customer).
This is the correct behavior to ensure data integrity. But is it possible to not only select the data in the related table but also allow manual input of other values?
Yes, you can find it in the standard features. Let’s see two examples.
1. Description on Sales Order Subform page.
You can select the data from the item table, or you can enter it manually, and there is no error.
2. City on the Customer Card page.
Similar to the above, you can enter any value.
How is this done? If you look at the base application of BC, you can find that there is ValidateTableRelation Property set in this field.
ValidateTableRelation Property: Sets whether to validate a table relationship.
Applies To: Fields
Property Value: Yes if you want to validate the table relationship; otherwise, No. The default is Yes.
For fields, use this property to determine whether to validate the user’s entry based on the information already in the table set up through the TableRelation Property property.
If you want to let users enter any value without validating the entry, then choose false. For example, on the item card, you can specify the vendor that you typically purchase the item from. Set this property to false to allow users to select a vendor that may not already be in the Vendor table.
Okay, let me do a small test. Add an End User Name field to the Sales header and relate it with the Customer table, but it also allows the user to manually enter it.
Isn’t it very simple? Give it a try.
Hope this will help.
Thanks for reading.