Workflows - branching and joining
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2013 08:13 AM
Am I doing this correctly?
I am BRANCHing out and creating 2 (or more) tasks - works fine.
Once all of the tasks have been completed/closed, I then want to continue with the workflow. So, I used a JOIN to bring the tasks back together.
The problem I have is that the stuff after the JOIN (log messages & notification) never seem to get sent.
In the system logs, I see:
2013-06-06 09:45:55InformationCreated task to create Name Badgeworkflow 2013-06-06 09:45:55DebugRunning activity The join: "update"workflow 2013-06-06 09:45:55DebugCreating activity Name Tagworkflow 2013-06-06 09:45:55DebugRunning activity The join: "activityComplete"workflow 2013-06-06 09:45:55DebugCreating activity The joinworkflow 2013-06-06 09:45:55DebugRunning activity ADMINISTRATIVE - Create Name Tag: "update"workflow 2013-06-06 09:45:55InformationTerminating context: 6464c761913d0500cd217ca6439f58e4, state: finishedWorkFlow
So, it looks like the workflow "state" is finished, but I don't get anything after the JOIN - even though it appears to perform the JOIN.
I am sure that this is simple too, once you get the hang of it!
Thanks!
Brent
- Labels:
-
Service Mapping

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2013 02:47 PM
I have always had different outcomes using Branch and Joins in workflows. One suggestion is to remove the Incomplete action on the Join object if you are not using it. Just right click on that action and a dialog box will show with actions include delete.
Looking at your workflow, you could remove the Branch and Join activity all together. Instead of the Branch object, perform the actions that drop straight through (administrative task and log) and then follow it up with the IF object and the following actions. If want to run the tasks at the same time and wait until they are all finished, you can a script object with the following code to check all the task are done before moving on.
// Set the variable 'answer' to true or false to indicate if the condition has been met or not.
//Query for all tasks to see if they are inactive
var rec = new GlideRecord('sc_task');
rec.addQuery('request_item', current.sys_id);
rec.addQuery('active', true);
rec.query();
if(rec.hasNext()){
answer = false;
}
else{
answer = true;
}
Good luck,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2013 06:05 AM
Would I have to have this code run on a timer to check every few minutes if the tasks are done?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2013 09:12 AM
It is more of a stop point and just monitors itself to check the values. Where I got this from is to do the same affect for change tasks to make sure they complete before closing a change.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2013 10:20 AM
This is a Wait for Condition Object that you would use. But insert the script that I posted earlier and it will wait until it is true (all the tasks closed). Sorry for the confusion.