Getting Error as :com.glide.script.RhinoEcmaError: Cannot convert null to an object

MD AQUIB KHAN
Giga Guru

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. @Ankur Bawiskar 

 

Regards,

Aquib

10 REPLIES 10

Ankur Bawiskar
Tera Patron

Hi,

Can you explain your business use-case?

Regards
Ankur

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

Hi,

So if the tables are not one of the above then show active users?

Regards
Ankur

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