Getting Error as :com.glide.script.RhinoEcmaError: Cannot convert null to an object
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2021 06:43 AM
Hi All,
I have written one query business rule which helps to track the inactive users on different table .
It is creating lots of warning logs which is impacting the performance of the instance .
Scripts:
Business Rule: user query. It is on sys_user table
var checkField1 = GlideTransaction.get().getRequest().getHeader("referer").toString().indexOf("alm_hardware");
var checkField2 = GlideTransaction.get().getRequest().getHeader("referer").toString().indexOf("cmdb_software_product_model");
var checkField3 = GlideTransaction.get().getRequest().getHeader("referer").toString().indexOf("samp_sw_publisher");
if (checkField1 != -1 || checkField2 != -1 || checkField3 != -1) {
//do nothing
} else {
current.addActiveQuery();
}
Error Message:
om.glide.script.RhinoEcmaError: Cannot convert null to an object.
sys_script.62a7bfaf0a0a0a6500c49682bd82376a.script : Line(3) column(0)
==> 3: var checkField1 = GlideTransaction.get().getRequest().getHeader("referer").toString().indexOf("alm_hardware");
4: var checkField2 = GlideTransaction.get().getRequest().getHeader("referer").toString().indexOf("cmdb_software_product_model");
5: var checkField3 = GlideTransaction.get().getRequest().getHeader("referer").toString().indexOf("samp_sw_publisher");
6:
How can I modify the scripts which will not impact the performance of the instance .Please help me in this regard.
Regards,
Aquib
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2021 07:06 AM
Hi,
Can you explain your business use-case?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2021 07:14 AM
Hi Ankur,
The business scenario was to view the records on table (alm_hardware) and other table records for the inactive users . This was basically to track the assets for the inactive users . Also to create the report on these tables.
Regards,
Aquib
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2021 07:24 AM
Hi,
So if the tables are not one of the above then show active users?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2021 07:40 AM
Hi Ankur,
Yes. It will be like for those mentioned table . We will be see the records i.e.assigned to for both inactive and active users . Else for the table we will be view the records for only active users.
Regards,
Aquib