Monday, February 15, 2010

Messages mentioning table or field

It is the best practice to use both table or field UI name and system name in error messages. For example, the standard “The record already exists” message looks like:
Cannot create a record in Inventory model groups (InventModelGroup). Inventory model group: Std, Standard. The record already exists.
So both UI name (Inventory model groups) and system name (InventModelGroup) appear in the message.
To retrieve those names tablepname() and tablestr() functions can be used correspondingly. For the fields there are similar functions: fieldpname() and fieldstr().

2 comments: