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

Re: Workflow task: select participants

$
0
0

possibly something like this (switch out of HTML mode to see correctly).  Adjust Role / path for your situation...

 

CODE On wORKFLOW ACTIVITY COMPLETE TRANSITION (FOR REVIEWER ROLE):

if(!ext.alcon.workflow.WorkflowHelper.verifyRoleForUserOffKey( (wt.lifecycle.LifeCycleManaged) primaryBusinessObject, "REVIEWER")) { throw new wt.util.WTException(new Throwable(new String("No Reviewer assigned!")));}

 

METHOD IN CUSTOM WORKFLOW HELPER CLASS    

/**      * Use this method to verify a user is in the team instance based on the key value of the role not the display name.
    public static boolean verifyRoleForUserOffKey(LifeCycleManaged pbo, String role){         LOGGER.debug("Entering verifyRoleForUserOffKey method passing in: LCM:"+pbo + " Role: "+role);         ArrayList wfusers = new ArrayList();         boolean roleExists = false;         boolean rolePopulated = false;         Team team = null;         try {             team = TeamHelper.service.getTeam(pbo);             HashMap wfparticipants = TeamHelper.service.findAllParticipantsByRole(team);             Object key = null;             Role wfroles = null;             Iterator wfset = wfparticipants.keySet().iterator();             while(wfset.hasNext()) {                 key = wfset.next();                 wfroles = (Role) key;                 if(wfroles.equals(Role.toRole(role))) {                     wfusers = (ArrayList) wfparticipants.get(key);                     roleExists = true;                 }             }         } catch(WTException exp){             exp.printStackTrace();         }         if(!roleExists) {             LOGGER.warn("The role : "+role+ " does not exists in the team "+team.getName());         }         if(wfusers.size()>0){             rolePopulated = true;         }         else{              rolePopulated = false;         }         LOGGER.debug("Exiting verifyRoleForUserOffKey method returning: "+rolePopulated);         return rolePopulated;     }


Viewing all articles
Browse latest Browse all 8876

Trending Articles



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