Need help in writing code to ensure problem have atleast one problem task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 09:13 AM
Need help in writing code to ensure problem ticket have at least one problem task apart from 2 mandatory Ptasks.
I have written below code to achieve the req based on mandatory ptask short description

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 11:32 AM
@sravya03 Instead of achieving this implementation through a client script, you should use a business rule instead.
Here is the BR script.
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var rec = new GlideRecord('problem_task');
rec.addEncodedQuery('short_descriptionNOT LIKEABC^short_descriptionNOT LIKEXYZ');
rec.query();
if (rec.getRowCount() == 0) {
gs.addErrorMessage('Please create a problem task');
gs.setAbortAction(true);
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2023 10:28 AM
Hi Sandeep,
The code is not working.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2023 11:34 AM
Change
gs.setAbortAction(true);
as
current.setAbortAction(true);