- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2023 10:59 PM
I need to fetch all the tasks under a request and check if we have any rejected tasks under it. If we have any rejected task previously then an event should be triggered. How can I achieve this through business rule
Can anyone please help
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2023 11:50 PM
Hi @Sowbarnika S1
You can write a onAfter insert BR on you task table with following logic.
(function executeRule(current, previous /*null when async*/) {
var task=new GlideRecord(current.getTableName())
task.addQuery('parent',current.parent);
task.addQuery('sys_id','!=',current.getUniqueValue());
task.addQuery('state','7');//Please check in your insatnce the value for closed skipped
task.query();
if(task.next())
{
gs.eventQueue();//Trigger the event
}
})(current, previous);
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2023 11:00 PM
Hi,
When you want to check if there is any rejected task previously?
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2023 11:04 PM
When a new task is created under a request.... I need to check if there are any previously rejected task under that particular request and have to trigger an event if there are any.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2023 11:22 PM
Hi
This can be done.
Can you please tell me the state of the task when it got rejected.
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2023 11:36 PM
when this task gets rejected the state will be changed to 'closed skipped'.
Could you please guide me on how to achieve this through business rule