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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Conditional connector

rserhan
1-Newbie

Conditional connector

I am trying to setup a conditional connector in a workflow to determine if the initiator belongs to a Role or Group, return true else false. Has anyone attempted this and willing to share the java code.


Thanks in advance

1 REPLY 1
dwilliams
6-Contributor
(To:rserhan)

The following expressions may be helpful. These was used in the
promotion workflow to determine if the creator was part of the
"Configuration Manager" group. You can probably clean this up somewhat
but it should get your started.



Expression Robot



wt.org.WTOrganization wtorg =
wt.org.WTOrganization.newWTOrganization("MyOrganization");
wt.org.DirectoryContextProvider directoryContextProvider =
(wt.org.DirectoryContextProvider) wtorg;
wt.maturity.PromotionNotice pn =
(wt.maturity.PromotionNotice)primaryBusinessObject;
String creatorUser = pn.getCreatorName().toString();

java.util.Enumeration windchillGroups =
wt.org.OrganizationServicesHelper.manager.findLikeGroups("Configuration
Managers", directoryContextProvider);
while (windchillGroups.hasMoreElements()) {
wt.org.WTGroup wtgroup = (wt.org.WTGroup)
windchillGroups.nextElement();
java.util.Enumeration usersEnum =wtgroup.members();
while(usersEnum.hasMoreElements()){
wt.org.WTUser user = (wt.org.WTUser)usersEnum.nextElement();
String groupUser = user.getName();
if (groupUser == creatorUser)
{
isAdmin = "True";
}
}
}



Conditional Expression



if (isAdmin.equals("True"))
{
result = "isAdmin";
}
else
{
result = "notAdmin";
}



Hope this helps,

Dax


Top Tags