cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

We are happy to announce the new Windchill Customization board! Learn more.

workflow condition check for populated role

vmcdaniel
2-Guest

workflow condition check for populated role

Hey All,

I'm trying to check the promotion request workflow if a role was populated during the initiation of the promo request, in the wizard; or if I need to branch off to a Setup Participants activity.
I'm adding a condition node in the workflow with the below, but it does not work. Although it should look familiar 🙂

Any code or tips for me?

Thanks Vaughn


boolean provider = false;
wt.workflow.engine.WfProcess wfprocess = (((wt.workflow.work.WfAssignedActivity)self.getObject()).getParentProcess());
java.util.Enumeration roles = wfprocess.getRoles();
while (roles.hasMoreElements())
{
wt.project.Role role = (wt.project.Role)roles.nextElement();
java.util.Enumeration participants = wfprocess.getPrincipals(role);
if (participants.hasMoreElements())
{
if (role.getDisplay().equalsIgnoreCase("Approver")) provider=true;
}
}
if (!provider)
{
result="SetupApprover";
}else{
result="AlreadySetup";
}

1 REPLY 1

Thanks for the help Jeff, Brian, Randy

Here's what is currently working for me:

result="Good";
boolean provider1 = false;
boolean provider2 =false;
boolean receiver = false;
System.out.println("Initialized Provider1 = " + provider1 +" Provider2 = " + provider2 + " Receiver = " + receiver);
wt.workflow.engine.WfProcess wfprocess = ((wt.workflow.engine.WfProcess)(self.getObject()));
java.util.Enumeration roles = wfprocess.getRoles();
while (roles.hasMoreElements())
{
wt.project.Role role = (wt.project.Role)roles.nextElement();
java.util.Enumeration participants = wfprocess.getPrincipals(role);
if (participants.hasMoreElements())
{
if (role.getDisplay().equalsIgnoreCase("Approver")) provider2=true;
if (role.getDisplay().equalsIgnoreCase("Contributor")) provider1=true;
}
}
System.out.println("Evaluated Provider1 = " + provider1 +" Provider2 = " + provider2 + "Receiver = " + receiver);
if ((provider1)&&(provider2)) result="Good";
else
{
result="null";
}



Be well,

Vaughn

Top Tags