Query Related to Fix script

vallusri
Tera Contributor

req_item.addEncodedQuery( 'active=true^stateIN3,4,7,1300,200^request.u_request_type=ESP service catalog^cat_item.workflow=b10a719a1b14d9589e324197b04bcbe0' + '^NQ' + 'active=true^stateIN3,4,7,1300,200^cat_item.nameINESP - Request New Integration,Cisco Catalog Builder Pre Approval' );
I have executed this query in the fix script, and it functions correctly; however, due to the presence of repeated conditions, I attempted to use an OR condition, which did not yield the desired results. Is there an alternative method to apply this query without repeating conditions? My objective is to merge the two conditions listed below into a single query within the fix script.
1. 'active=true^stateIN3,4,7,1300,200^request.u_request_type=ESP service catalog^cat_item.workflow=b10a719a1b14d9589e324197b04bcbe0'
2. 'active=true^stateIN3,4,7,1300,200^cat_item.nameINESP - Request Catalog Builder'. Please assist me in optimizing this query.

6 REPLIES 6

Ankur Bawiskar
Tera Patron

@vallusri 

try this

req_item.addEncodedQuery(
    'active=true^stateIN3,4,7,1300,200^request.u_request_type=ESP service catalog^cat_item.workflow=b10a719a1b14d9589e324197b04bcbe0' +
    '^NQ' +
    'active=true^stateIN3,4,7,1300,200^cat_item.nameINESP - Request New Integration,Cisco Catalog Builder Pre Approval'
);

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

vallusri
Tera Contributor

Hi Ankur,

Thank you for your prompt response. However, the same common query "active=true" and state='3.4,1300'

 

"is recurring here. Without that repetition, can we construct the query using an OR condition?