Quantcast
Channel: PTC Community: Message List - Windchill
Viewing all articles
Browse latest Browse all 8876

Re: How to obtain the group of a user within a workflow?

$
0
0

This might help you get started. This code finds the assignees for a workflow activity.

 

         String name[] = new String[100];

         for (int j=0; j<name.length; j++){name[j] = null;}

         int i = 0;

         try

         {

          wt.workflow.work.WfAssignedActivity wfact = (wt.workflow.work.WfAssignedActivity) self.getObject();

          java.util.Enumeration assignments = wfact.getAssignments();

          while (assignments.hasMoreElements())

          {

           wt.workflow.work.WfAssignment assignment = (wt.workflow.work.WfAssignment) assignments.nextElement();

           java.util.Enumeration principals = assignment.getPrincipals().elements();

           while (principals.hasMoreElements())

           {

            wt.org.WTPrincipalReference wtpr = (wt.org.WTPrincipalReference) principals.nextElement();

            name[i] = wtpr.getDisplayName();

            i++;

           }

          }

         }

         catch(java.lang.ClassCastException cce)

         {

          throw new WTException("Only WfAssignment objects can get assigned Principals" + cce);

         }

 

To find the groups that the user belongs to, you can use the wt.org.OrganizationServicesHelper.manager class to find methods for retrieving that info.

 

Hope this helps.


Viewing all articles
Browse latest Browse all 8876

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>