- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2017 03:44 PM
I am trying to add some alternate paths to the Normal Change workflow to be able to move through the change state model without too much customization.
Requirement:
- (a) Workflow should process normally if people click the OOB UI actions that move the change along the normal state model.
- (b) If there are multiple manually created change_tasks, when the last task is moved into one of the three closed states it should:
- if change_request is not already in 'implement' it should set the change_request to implement, then set the change request to 'review';
- if change_request is already sitting at 'implement', it should then just move it to 'review.
First attempt was to create a BR on change_task to do this and got it working my using a script in a wait for condition activity. However, we have been asked to keep it in the workflow.
2nd attempt was to start branching the workflow to account for both path (a) the normal OOB path and path (b) where we automatically increment the states along the state model path when last change task closes.
I'm attaching a screen shot of how I think it should be working, when process a change request and manually close the last change_task it appears to branch correctly, however when it transitions to set to review there is a Debug statement saying it cannot transition from 'scheduled' directly to 'review'. The issue is one of the proceeding activities is to set the change request to implement first and it transitions through this activity and then transitions through the wait for Implement activity and then sets review.
not sure if there is a timing issue or I need to add explicit joins but cannot figure out how to structure this workflow to accomplish both paths using wf activities only.
Thanks,
-e
Solved! Go to Solution.
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2017 03:27 AM
Hi Erik,
I am still not sure why you need multiple paths, though.
Here is what I did:
5 :
answer = checkCloseConditions();
function checkCloseConditions() {
var task = new GlideRecord('change_task');
task.addQuery('change_request', current.sys_id);
//task.addQuery('state','NOT IN','3,4,7,9'); //you can use this to indicate the un-required states
task.addActiveQuery(); //or use this, if you want them to be closed
task.query();
if(task.hasNext()) {
return false;
}
return true;
}
The advantage is that you can remove 2, 3, 4 because it works in two situations:
1. if the request is in state scheduled and there are no tasks, and the end user clicks on Implement, the change will move to implement and reach 6.
2. if the request is in state scheduled and there are tasks waiting, the change state can still be moved to implement, but the flow itself will not go past 5 until the tasks are closed. This will allow you to add more tasks in state Implement, although the flow will not continue until everything is closed.
Tell you the truth, I am unclear why you're branching it. How are tasks being opened? Because according to your flow, you don't need the second branch; if there are tasks, they will be closed before the first join, wait for Implement and once that state is reached, there will be no open tasks and the change will go straight to Review. If there are no tasks, the change flow will check for tasks, and if there are none, it will change state to Implement and move on automatically (wait for condition Implement will be reached, then check again for non-existent tasks, set the state to review and so so on).
harel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2017 08:07 AM
Hi Erik,
Thanks for the updates. Let me know if you need more help
harel