Notifications

15 views

Description

Script includes are used to store JavaScript that runs on the server. You can call an existing script include from a script or even from a report. This article will give you an example of how to call a script include through reports. Usually, we use reports to pull the data using existing or current values. Sometimes, the reporting requirement might get complex and we may not be able to use the conditions to fetch the desired results. We might need to get the result(dynamic records) through a script include.


Release or Environment

All Releases

Instructions

1. You can use the sys_id column to get dynamic records. In report have the following condition,

sys_id is javascript:new ReportUtils().getRecords() where "ReportUtils" is the script include name and getRecords is the function name in the script include.

2. You can even go through the below KB's for few examples:

https://hi.service-now.com/kb_view.do?sysparm_article=KB0832051

https://hi.service-now.com/kb_view.do?sysparm_article=KB0828597

3. Create a business rule and call the function defined in the business rule. For example, refer the OOB business rule "getMyApprovals". It has a function "getMyApprovals". You can call this script using the below syntax:

Approver is javascript:getMyApprovals()

Article Information

Last Updated:2020-07-15 04:32:54
Published:2020-07-15