15
Views
1
Comments
Retrieve table name for human friendly error message
Question
Hi all,

Does anybody know whether it is possible to retrieve the table name from a table defined in Outsystems. What happens is following for example:
- Table Employee (id, name, department-id)
- Table Department (id, description)
Employee table references department table.
If I try to delete a department record that has employees linked I will get a reference error from the database (in my case SQL Server). the error message is quite user unfriendly.
It is something like:
The DELETE statement conflicted with the REFERENCE constraint "OSFRK_OSUSR_KWK_EMPLOYEE_OSUSR_KWK_DEPARTMENT_DEPARTMENTID". The conflict occurred in database "outsystems_test", table "dbo.OSUSR_KWK_EMPLOYEE", column 'DEPARTMENTID'. The statement has been terminated.

I would rather pop a message like:
Could not delete DEPARTMENT XYZ because there are EMPLOYEES linked.

The wording in capitals are dynamic.
2016-04-21 20-09-55
J.
 
MVP

well,

not out of the box.

If you really want to have it dynamic, then you should parse the error

and look in the enity-table for the friendly name.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.