I want to get the catalog tasks which are closed complete based on short description
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2023 11:01 AM
Hi Team,
I want to get the catalog tasks which are closed complete based on short description. In the IF condition I need to have multiple condition should be added.
When both condition are met I need to enter into the if condition.
Can you please help how to do it.
var grTask = new GlideRecord('sc_task');
grTask.addQuery('request_item','c075f9251b153d10c961a9fbbc4bcb8e');
grTask.query();
while (grTask.next()) {
if ((grTask.short_description.includes('Account ID Created In Azure')&& grTask.state == 3) && (grTask.short_description.includes('Azure account creation')&& grTask.state == 3)) {
gs.log("snow===" + grTask.number);
}
//gs.log("Catalog Tasks==="+grTask.number);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2023 09:10 AM
but I need to look for multiple conditions.
grTask.addEncodedQuery('state=3^short_descriptionLIKEAccount ID Created In Okta^ORshort_descriptionLIKEokta account creation');
this above one is completely another requirement do you want me to write another glide record?.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2023 09:25 AM
Nope, the code perfectly fine, the getrowCount ==2 makes sure you have exactly two task already closed as delfined with the shirt description.
I just say that relying on short decription value and search for it not best practice because any could change that, so your query would fail. I think there is Order field on sctask, so may you can set that fix value when you create sctasks, so your search code would checkn if order 100 and order 200 both closed - > to do what you need.