Why this Business Rule Script not working fro me?

1dusjhyahnt
Tera Contributor
(function executeRule(current, previous /*null when async*/) {

// Add your code here

current.addEncodedQuery('sys_created_onNOTONLastyear@javascript:gs.beginningOfLastYear()@javascript:gs.endOfLastYear()');

})(current, previous);
10 REPLIES 10

Ankur Bawiskar
Tera Patron
Tera Patron

@1dusjhyahnt 

did you form the query using filter condition and copy the correct query?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hii @Ankur Bawiskar 

No , without filter i am using and this is not a copy and paste query  i wrote this query ??please can you check this where is the mistake 

@1dusjhyahnt , 

 

Creating custom Quries can lead to complexity when used in script, its recommend to apply filters on list view and use the system provided query for safer use. 

 

You can apply your query logic on list view and right click on filter breadcrumbs and choose copy encoded query.

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

@1dusjhyahnt 

how did you come to the conclusion of that above query?

what's your requirement?

You can directly form the filter condition as per your business requirement, copy the query and use in Encoded query

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader