BC’s standard functionality of storing a city, state and zip combination in a table seems problematic. Is there anyway to turn that off and just have those be non-validated fields? If not, is there somewhere to get a list of city/state/zip combos - we have customers from all over the world, so we’d need combos from lots of countries. We have address data entered directly in BC, but most of it comes in via integrations from our CRM, HR, and Sales systems. Those systems currently don’t use address validation, so data coming into BC may or may not have an accurate city/state/zip combo.
If you’re getting this from different integration, then save data without validation or ask your partner to first save unknown values in master data and then save it in Sales Table. It will fix because I have many eCommerce related integration and I handle like this. First check is State exists or not, if not then create and then save it the Sales.
There are three possible ways to overcome this issue, based on your preference:
- If you don’t care about the format
This works only if you or your organization designed the code to save data from a third party into Business Central base fields.
In this case, if the format does not matter (for example, you expect city/state/zip but the CRM user might send state/zip/city or zip/city/state), you can simply modify and save the data without validation.
To do this, call the Modify() method with the parameter set to false.
Example:
table_reference.modify(false);
- If you care about the format
This also works only if you or your organization designed the code to save data from a third party into Business Central base fields.
Here, you can call an API endpoint to get the data from the third party. Using a coding strategy, you can restructure the data into the required format. Once formatted, save the value without validation using:
table_reference.Modify(false);
- If you want to avoid extensive coding
This is the simplest approach. Extend the table where you want to store the combined field as a text field. While extending the table, create a new custom field and leave the OnValidate trigger empty.
This way, no validation will occur, and the field will store whatever data is received from the third party.