Notifications

12 views

Description


This article focuses on how to load only those set of records in the list view that are explicitly defined on base-tables.

Procedure


For each base table, there is a column/field/dictionary called sys_class_name that shows the table name for each record created:

  • This field shows the name of the table where this record is defined (on child table or parent table or base table).
  • This field can act as a key for filtering the records.

The following example demonstrates this:

  • Create before-query business rule on a table let's say, task with the following script:
    (function executeRule(current, previous /*null when async*/) {
    // Add your code here
    current.addQuery('sys_class_name', 'task');
    })(current, previous);
  • The above script will show only those records that are explicitly created at task table (filtering out records from incident, problem, etc.)
  • One caveat here is that this will not just impact the list view (of task table) but on all aspects through which this table is queried.

You can also create a default filter that will run whenever the list is loaded.

Applicable Versions


Jakarta, Kingston and London.

Additional Information


This is kind of a custom behavior and it all depends on respective data integrity. It will break otherwise.

Set a predefined filter as result: https://docs.servicenow.com/bundle/london-servicenow-platform/page/product/business-service-management-map-ng/task/set-predefined-filter-default.html

Default before-query business rule: https://docs.servicenow.com/bundle/london-application-development/page/script/business-rules/concept/c_ExScrDefBeforeQueryBusinessRule.html

Instance Customization FAQs and Guidelines: https://hi.service-now.com/kb_view.do?sysparm_article=KB0553407

Article Information

Last Updated:2018-11-26 11:05:56
Published:2018-11-26