Query Related to Fix script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hello @vallusri
Use this:
var commonQuery = 'active=true^stateIN3,4,7,1300,200';
req_item.addEncodedQuery(
commonQuery +
'^request.u_request_type=ESP service catalog' +
'^cat_item.workflow=b10a719a1b14d9589e324197b04bcbe0' +
'^NQ' +
commonQuery +
'^cat_item.nameINESP - Request New Integration,Cisco Catalog Builder Pre Approval'
);
Hope that helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi Vishal,
Thank you for your prompt response. However, the same common query is recurring here. Without that repetition, can we construct the query using an OR condition?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hello @vallusri
I would recommend to use snutils browser plugin only if your IT approves it.
To achieve below logic:
active=true
AND state IN (3,4,7,1300,200)
AND
(
(
request.u_request_type = ESP service catalog
AND cat_item.workflow = b10a719a1b14d9589e324197b04bcbe0
)
OR
(
cat_item.name IN (
ESP - Request New Integration,
Cisco Catalog Builder Pre Approval
)
)
)
You can use below:
reqItem.addQuery('active', true);
reqItem.addQuery('state', 'IN', '3,4,7,1300,200');
// First condition block
var requestTypeQuery = reqItem.addQuery(
'request.u_request_type',
'ESP service catalog'
);
// Add workflow condition to first block
requestTypeQuery.addCondition(
'cat_item.workflow',
'b10a719a1b14d9589e324197b04bcbe0'
);
// OR condition block
requestTypeQuery.addOrCondition(
'cat_item.name',
'IN',
'ESP - Request New Integration,Cisco Catalog Builder Pre Approval'
);
Hope that helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7m ago
Hi @vallusri
Try it.
var query1 = 'active=true^stateIN3,4,7,1300,200';
var queryPart2 = '^request.u_request_type=ESP service catalog^cat_item.workflow=b10a719a1b14d9589e324197b04bcbe0' ;
var queryPart3 = '^cat_item.nameINESP - Request New Integration,Cisco Catalog Builder Pre Approval';
req_item.addEncodedQuery( query1 + queryPart2 + '^NQ' + query1 + queryPart3 );
