give the code for following creitiria on basis of Businees Rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2023 07:10 PM
As an LOA user I need the employee's task and LOA Advocate task to be canceled if the request was canceled.
- Verify that if the request is cancel then the state of the all task is "Cancelled" (employee and LOA Advocate task)
- Verify that if the state of the task is "Cancelled" then the fields are non-editable (grey out) for the Advocate.
- Verify that no changes are needed if the task's state is "Closed" when the request is canceled.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2023 07:14 PM
Hi @Apoorva A H ,
Are these things on Catalog Request and Catalog Task or a different module.
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2023 07:52 PM
It is in request module.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2023 08:18 PM
HI @Apoorva A H ,
I trust you are doing great.
Sample Business Rule Script:
(function executeRule(current, previous /*null when async*/) {
if (current.state == 'cancelled') { // assuming 'cancelled' is the correct state value
var grTask = new GlideRecord('task_table_name'); // replace 'task_table_name' with your task table name
grTask.addQuery('request', current.sys_id); // assuming 'request' is the field linking task to request
grTask.query();
while (grTask.next()) {
grTask.state = 'cancelled'; // set to your 'Cancelled' state value
grTask.setWorkflow(false); // to prevent any further business rules from triggering
grTask.update();
}
}
})(current, previous);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi