addQuery for shortDescription text

Community Alums
Not applicable

Is there a way to check if a task with a specific short description has been closed by using addQuery?

(function executeRule(current, previous /*null when async*/ ) {

// Prevents proceeding to the Qualified State from Screening state, if Tasks have not been completed, and approval has not been received.
if (previous.getValue('state') == '3' && current.getValue('state') == '-4') {
var grDemandTask = new GlideRecord("dmn_demand_task");

grDemandTask.addQuery("parent", current.getValue("sys_id"));
grDemandTask.addQuery("active", true);
grDemandTask.query();
if (grDemandTask.next() && current.getValue('approval') == 'approved' || current.getValue('approval') != 'approved') {
//Don't proceed
gs.addInfoMessage('Please Complete the Demand Tasks, and approval ');
current.setAbortAction(true);
}
}
})(current, previous);

1 ACCEPTED SOLUTION

Mike_R
Kilo Patron
Kilo Patron

You can use addQuery or addEncodedQuery

 

grDemandTask.addQuery('short_description', 'CONTAINS', 'text here');

grDemandTask.addEncodedQuery('short_descriptionLIKEtextHere');

View solution in original post

1 REPLY 1

Mike_R
Kilo Patron
Kilo Patron

You can use addQuery or addEncodedQuery

 

grDemandTask.addQuery('short_description', 'CONTAINS', 'text here');

grDemandTask.addEncodedQuery('short_descriptionLIKEtextHere');