- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2016 03:10 AM
Hi,
I have a requirement to do a workflow to deal with approvals. What I am looking to do is to is when the ticket is logged, it should branch off onto two separate branches, one which will send the approval email to the approver and resend it if there is no reply within a certain period of time (Branch A) and the second has a wait for condition which waits for the request to be approved (Branch B). This is to allow the request be manually approved if required.
What I am looking to do is to end the activities on Branch A (ie, the resending of the approval email) if the wait for condition is met on Branch B. Currently, the only way of achieving this is to have both branches go to an "End" activity but this is not possible in my situation as I need to do some other activities after the request is approved.
You can see on the screenshot below that even though the wait for condition has been met on the lower branch, the timer activity remains active and will send the email once the timer reaches the time specified.
Has anybody come across this situation before and if so, how did you get around it.
NOTE: I have also tried using a subflow where my approval takes place in a separate workflow and this is called in my main workflow. This allowed me to go to an end activity in the subflow and this cancelled the other branch, however, the issue I faced on this occasion was that once my subflow completed, it would stop my main workflow from running at the next activity so not sure what I was doing wrong there either.
Any assistance would be greatly appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2016 12:31 AM
Hi Mayur,
Thanks for your suggestion above. I did manage to find a way yesterday after finding the below link.
How to get a subflow return value
Just in case anybody else is wondering how this works, below is an excerpt from my main workflow which calls the subflow "File Share Approvals Workflow":
Double click on the "Workflow" activity to open the properties. Set the "Map return value to" value to a scratchpad variable name, in this case workflow.scratchpad.subflow_result
Next, if we look at our subflow, we need to add a "Return Value" activity on each of the transitions leading into the "End" activity.
For example, on the path where our request was approved, we can set the value to "approved" or any value we choose. Now, any time our subflow goes down this route, our variable workflow.scratchpad.subflow_result will have a result of approved.
Remember to add a return value activity for each path leading to the "End" activity on the subflow.
Now back in the main workflow, on the if statement "Test Subflow" (see first image above), we can enter the above code to test the outcome of the subflow:
answer = ifScript();
function ifScript() {
gs.log("subflow result="+current.subflow_result);
if (workflow.scratchpad.subflow_result == "approved")
return 'yes';
else
return 'no';
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2016 08:23 AM
Hi James,
I once faced the same problem, I found several solutions but it takes few more steps to be added and then there is complexity too.
Why don't you go with 'Lock Activity' its a core workflow activity. It will sent notification for some desired time and then it just stops. And you are good to go for next activity to execute. This is what I preferred. It worked.
Well you can also go for Run script or Wail for Condition put condition there and then timer, but then you will have to use Set Value Activity, because that will be the parameter you script condition is based on. i.e, If manager approves set value of some field to "XXX" now in condition check if('Some_field_value'!='XXX') send notification else proceed.
Please share if Requirement still doesn't meat. I'll look in to some more solutions.
Regards,
Mayur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2016 12:31 AM
Hi Mayur,
Thanks for your suggestion above. I did manage to find a way yesterday after finding the below link.
How to get a subflow return value
Just in case anybody else is wondering how this works, below is an excerpt from my main workflow which calls the subflow "File Share Approvals Workflow":
Double click on the "Workflow" activity to open the properties. Set the "Map return value to" value to a scratchpad variable name, in this case workflow.scratchpad.subflow_result
Next, if we look at our subflow, we need to add a "Return Value" activity on each of the transitions leading into the "End" activity.
For example, on the path where our request was approved, we can set the value to "approved" or any value we choose. Now, any time our subflow goes down this route, our variable workflow.scratchpad.subflow_result will have a result of approved.
Remember to add a return value activity for each path leading to the "End" activity on the subflow.
Now back in the main workflow, on the if statement "Test Subflow" (see first image above), we can enter the above code to test the outcome of the subflow:
answer = ifScript();
function ifScript() {
gs.log("subflow result="+current.subflow_result);
if (workflow.scratchpad.subflow_result == "approved")
return 'yes';
else
return 'no';
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2018 06:58 AM
Hi Tamara,
Just as an additional point here, rather than going with an If statement to check the return value of the subflow, you can simply create exit conditions on the subflow and set conditions on each of these.
Subflow Added To Test AD Servers:
Workflow Activity Properties:
Double click on the workflow above to edit these.
In my example, this maps the return value to workflow.scratchpad.subflow_ad_active_server
Pass Exit Condition:
workflow.scratchpad.subflow_ad_active_server != 'Failure'
NOTE: where the return value is NOT equal to "Failure"
Failure Exit Condition:
workflow.scratchpad.subflow_ad_active_server == 'Failure'
This might be easier to follow in the workflow but will depend on how easy your conditions are. In my case, these were relatively simple, it either returned Failure or it didn't.