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

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.

now my script is working fine Thanks

 

vkachineni
Kilo Sage
Kilo Sage

// This compiled on my PDI

 

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());

 

 

//

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

Sivakumar7
Kilo Contributor
Hi Lorenz, Code is compiled successfully but I am not getting the exact count of records but I have used the exact filter query copied to this code.. Do you have any idea? Regards, Sivakumar