Forum Discussion
Hey Gopikrishnan,
Have you tried containing it in a subflow? We've done this with our workflows and seems to work well.
To accomplish this you will need to have an activity step on your main workflow with a workflow in the subflow area that contains your parallel activity steps and end steps for each possible path from the subflow with a method that assigns the path name to a property on you Item that the workflow is running on (this is the way I do it there may be a better way). When leaving the subflow it will need an automatic activity that has all the possible paths and a method that assigns the path it needs to go down. When the subflow closes it will close your parallel steps and go to the rework step.
Steps:
- Create a workflow with your parallel steps in it.
- The start activity on the workflow will need to have default paths to all the first parallel steps.
- The workflow will also need end activities with methods that can choose the paths you need to take on the way out.
- I have mine setup so that the method gets the name of the end activity which matches the name of the path that needs to be taken and sets it on the item the workflow is running on as a property called "wfbranch".
- examples:
- End Activities in Subflow:
- Complete
- Cancel
- Rework
- Paths from Auto Activity outside of subslow:
- Complete
- Cancel
- Rework
- End Activities in Subflow:
- examples:
- Your forward moving end activity will need to be a wait for all inputs. This is so all the parallel activities can finish before closing the subflow.
- Rework steps will just need to be end steps.
- I have mine setup so that the method gets the name of the end activity which matches the name of the path that needs to be taken and sets it on the item the workflow is running on as a property called "wfbranch".
- Add an activity to your main workflow and assign the workflow you created as the subflow.
- Add an automatic activity after your subflow activity.
- Add a single path from your subflow activity to the automatic activity and make it the default.
- Add all possible paths that can be taken to the automatic activity and add a method to it that will determine which path to take based on the property that was set on the end steps.
Note: We are currently trying to do this with 2 subflows that need to move in parallel and are having an issue where one of the subflows stays open. Outside of that scenario this works like a charm.
Methods you will need:
C# method sets the wfBranch on End Activity of subflow:
Innovator inn = this.getInnovator();
Item itm = this.apply("GetControlledItem");
string wfBranch = "";
wfBranch = this.getProperty("keyed_name");
itm.setAction("edit");
itm.setProperty("wfbranch", wfBranch);
itm.apply();
return this;
if you don't have the GetControlledItem method you can find it here....
https://gist.github.com/YoannArasLab/817184c84b7dec9e0dd3105c9d456632
C# Method that tells Automatic activity which path to take:
Innovator inn = this.getInnovator();
Aras.Server.Security.Identity plmIdentity_New = Aras.Server.Security.Identity.GetByName("Aras PLM");
bool PermissionWasSet_New = Aras.Server.Security.Permissions.GrantIdentity(plmIdentity_New);
Item itm = this.apply("GetControlledItem");
string branch = itm.getProperty("wfbranch");
Item itmActivityPaths = this.newItem("Workflow Process Path", "get");
itmActivityPaths.setProperty("source_id", this.getID());
itmActivityPaths.setProperty("is_default", "1");
itmActivityPaths.setAttribute("select", "id");
Item itmUpdateActivityPaths = itmActivityPaths.apply();
if(itmUpdateActivityPaths.getItemCount() > 0){
itmUpdateActivityPaths.setAction("edit");
itmUpdateActivityPaths.setProperty("is_default", "0");
itmUpdateActivityPaths = itmUpdateActivityPaths.apply();
if (itmUpdateActivityPaths.isError())
{
return inn.newError("WFBranchChk: 1. Error updating default path: "+ itmUpdateActivityPaths.getErrorDetail());
}
}
Item itmAssignDefaultPath = this.newItem("Workflow Process Path", "get");
itmAssignDefaultPath.setAttribute("select", "id");
itmAssignDefaultPath.setProperty("source_id", this.getID());
itmAssignDefaultPath.setProperty("name", branch);
Item itmSetDefaultPath = itmAssignDefaultPath.apply();
itmSetDefaultPath.setAction("edit");
itmSetDefaultPath.setProperty("is_default", "1");
itmSetDefaultPath = itmSetDefaultPath.apply();
if (itmSetDefaultPath.isError())
{
return inn.newError("WFBranchChk : 2. Error setting default path: "+ itmSetDefaultPath.getErrorDetail());
}
if (PermissionWasSet_New)
Aras.Server.Security.Permissions.RevokeIdentity(plmIdentity_New);
return this;
- Gopikrishnan7 years agoIdeator I
Hi Phinnix
It works but still I can see the subflow has the active task n In Basket with activity Delegate and Refuse (actual subflow is already closed but task from subflow is still active). How to make it disappear from user In Basket
Thank You
Gopikrishnan
- Kyle_V_7 years agoIdeator I
Hey Gopikrishnan,
Sorry about the delay in the response. I'm not sure why that step would have stayed open the only time we've experienced this issue is when we have two subworkflows running parallel within a subworkflow of a main workflow. If you are trying to run your parallel paths like this you will need a separate solution. I currently have a user testing a solution for the above scenario and if it works I'll link to my forums post where I'll post the solution to this. outside of this being the case I have a few questions.
Is this Rework step the autostep that you are assigning your path from in prep for exiting the subworkflow?
If it is. Is it also the an end step of the subworkflow?
If it's not it might need to be.
Where does it go once it leaves your subworkflow?
Also screenshots of the workflow would help so I can see where and what is getting stuck.- Gopikrishnan7 years agoIdeator I
Hi Phinnix
Main Workflow
In Review has Parallel Activity (Automatic Activity)
Sub Workflow
Complete is Automatic Activity and Wait for all inputs is selected and End Activity
Rework is not Automatic Activity and Wait for all inputs is not selected and End Activity
Server Events is attached to Complete and Rework Activity
Any help will be much appreciated