Managing Change Tasks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2017 04:02 AM
I have a Workflow that is used for the creation of Change Requests. The Workflow automatically extracts information from the change form (Implementation Plan and Test Plan fiels) and creates 2 Change Tasks when the Change Request is submitted to Review Request. That's easy.....job done.
However, there are instances when the Change Request is Rejected due to insufficient of incorrect information. At this point, the State of the Change Request is reset to Draft.
No here's the challenge. Just suppose the details of the Implementation Plan or Test Plan are then updated to address the issue that caused the Change Request to be Rejected. and the change is then progressed to Review Request again. According to the Workflow, new Change Tasks should be created and populated with the (updated) information from the Change Request.
When I try this, it all works fine but..... no new Change Tasks are created and the original Change Tasks are not updated. They retain the original (now incorrect) details.
How do I make the Workflow update the existing Change Tasks, or create new Change Tasks?
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2017 07:03 AM
The advanced script only runs when the activity creates a NEW task. Since they are already existing, you need to put a condition in advance of the task activities to check for tasks and update them and then bypass the task activities.
As you can see in my example below, before the creation of tasks I put a If condition that checks for existing tasks and if found it updates the description and returns Yes there are tasks. If none are found then it branches to the task activities. Both go to the "next activity after tasks" so whatever activities you have after the tasks.
Here is the script in the If activity:
answer = hasTasks();
function hasTasks() {
var changeTask = new GlideRecord("change_task");
changeTask.addQuery("change_request", current.sys_id);
changeTask.query();
if (changeTask.hasNext()) {
while (changeTask.next()) {
changeTask.description = current.implementation_plan;
changeTask.update();
}
return 'yes';
} else {
return 'no';
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2017 07:46 AM
Woohoo! that worked perfectly. Makes common sense when you can see the answer. The clue is in the name CREATE TASK no UPDATE TASK! Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2017 08:03 AM
Awesome glad it worked for you. Please mark this post with the appropriate answer so others viewing can benefit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2017 08:07 AM
Hold on..... that will update the DESCRIPTION on all Change Tasks. I need to figure out a way to update certain Tasks if the TEST PLAN changes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2017 08:13 AM
Is there a need to create the tasks before the approval happens? Notice in my example flow the tasks are created after approval happens. Maybe this simplifies and solves your issue?