81 views

Description

Change records related to CAB meetings might produce the following error: Syntax Error or Access Rule Violation detected by database (Unknown column 'cab_meeting.sys_class_name' in 'field list') if the column sys_class_name is present on the table cab_meeting instead of its base table mtg_meeting ('Meeting'). If the OOB sys_class_name is not present on mtg_meeting table and if you make cab_meeting extendable, the sys_class_name field will be created on it instead of the base, which leads to this issue.
 
Otherwise, these tables will seem to work correctly, but without the sys_class_name field, there is nothing to tell the platform which record type is being viewed/inserted/updated/deleted, so the platform will use the table name.
 
By nature of Table Per Class hierarchy, any sys_id value that exists on cab_meeting should also exist in mtg_meeting, otherwise that record will be broken.

These records should have the sys_class_name value "cab_meeting" so if they are opened from mtg_meeting table list, the platform will open them on the cab_meeting form. Without the sys_class_name, opening these records from the mtg_meeting table will open them on the mtg_meeting form without loading fields defined on the cab_meeting table.

Steps to Reproduce

  1. Activate CAB Workbench with demo data.

    Confirm there is no mtg_meeting.sys_class_name field

  2. Open a record that exists in both mtg_meeting and cab_meeting from each of the tables in two separate tabs.

    Observe how the record is loaded as an mtg_meeting in one tab and as a cab_meeting record on the other.

  3. Open the sys_db_object record for cab_meeting.

  4. Make it extendable.

  5. Create a new table, extending cab_meeting.

  6. Observe sys_class_name field is added to cab_meeting instead of the base table of this hierarchy.

  7. Open a change record related to a CAB meeting.

    Observe the error "Error MessageSyntax Error or Access Rule Violation detected by database (Unknown column 'cab_meeting.sys_class_name' in 'field list')"

 

Workaround

If no sys_class_name field exists on this hierarchy, it will need to be created on mtg_meeting table. The name of this field requires that it is created by ServiceNow Support.

Otherwise, if a sys_class_name field is on the hierarchy because a child table was made extendable, it can be promoted to the base table:

GlideDBUtil.promoteColumn(sourceTable, targetTable, column, promoteCheck)
/* 
Moves (promotes) a column from one table to another in the table hierarchy, optionally verifying the relationship between source and target tables. If the move is a promotion, this will move all columns from the child tables that have the same column name as the target column name. Otherwise, it will only move the column from the source table to the target table. * @param sourceTable (string) - The table currently containing the column to be promoted. * @param targetTable (string) - The table that will have the column after promotion. * @param column (string) - The column to be promoted. * @param promoteCheck (boolean) - This method should verify that the source table is a child of the target table.
*/

Related Problem: PRB1269711

Seen In

There is no data to report.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-07-01 03:39:46
Published:2018-07-01