Fix script is getting compilation error

Sivakumar7
Kilo Contributor

Hi Guys, 

My requirement: I need to update the incident records to close state from the created date with filter conditions as I have used in below fix script and I am getting the below error "Javascript compiler exception: missing ) after argument list (null.null.script; line 3) in:"

var inc = new GlideRecord('incident');

inc.addEncodedQuery('active=true^assignment_group=ba1859496f000200c0c334afae3ee406^sys_class_name=incident^short_descriptionLIKEPercent Used Space is too high::AlertKey^sys_created_on>=javascript:gs.dateGenerate('2019-04-24','10:00:00')');

inc.query();

gs.print(inc.getRowCount());

 

Regards, 

Sivakumar

 

 

1 ACCEPTED SOLUTION

Lorenz
Tera Contributor

Here:

('active=true^assignment_group=ba1859496f000200c0c334afae3ee406^sys_class_name=incident^short_descriptionLIKEPercent Used Space is too high::AlertKey^sys_created_on>=javascript:gs.dateGenerate('2019-04-24','10:00:00')');

change to double quotes:

("active=true^assignment_group=ba1859496f000200c0c334afae3ee406^sys_class_name=incident^short_descriptionLIKEPercent Used Space is too high::AlertKey^sys_created_on>=javascript:gs.dateGenerate('2019-04-24','10:00:00')");

The single quotes surrounding your date is interfering with the quotes around your query.

View solution in original post

5 REPLIES 5

Try the URL to see if you are getting any incidents in the list.

https://yourinstance.service-now.com/incident_list.do?sysparm_query=active=true^assignment_group=ba1859496f000200c0c334afae3ee406^sys_class_name=incident^short_descriptionLIKEPercent%20Used%20Space%20is%20too%20high::AlertKey^sys_created_on%3E=javascript:gs.dateGenerate(%272019-04-24%27,%2710:00:00%27)

Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Vinod Kumar Kachineni
Community Rising Star 2022