Conditional connector
Oct 12, 2011
10:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Oct 12, 2011
10:05 AM
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
Labels:
- Labels:
-
Other
1 REPLY 1
Oct 12, 2011
11:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Oct 12, 2011
11:49 AM
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
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
