Quantcast
Channel: PTC Community : Unanswered Discussions - Windchill
Viewing all articles
Browse latest Browse all 3592

Returns the username of a user entered in the "setup participants" as String.

$
0
0

Dear,

 

I'm trying to save the username of the user Entered in the "setup participants" as String attribute in the document.

 

Using the code below, it returns me the id of the user, for example wt.org.WTUser:58330. The document attribute i want to save is the "elab".

 

Can we help me find a way to turn this username in the User ID? The code below is embedded in the task transitions> complete.

 

wt.org.WTPrincipal wtprincipalelab=null;
wt.org.WTPrincipal wtprincipalverif=null;
final String roleElaborador= "ELABORADOR";
wt.workflow.engine.WfProcess wfprocess = ((wt.workflow.work.WfAssignedActivity)self.getObject()).getParentProcess();
java.util.Enumeration pinwf = wfprocess.getPrincipals(wt.project.Role.toRole(roleElaborador));
int count = 0;

while (pinwf.hasMoreElements()){
       wtprincipalelab = ((wt.org.WTPrincipalReference)pinwf.nextElement()).getPrincipal();
elab=wt.fc.PersistenceHelper.getObjectIdentifier((wt.org.WTUser)wtprincipalelab).toString();

  System.out.println("ELAB**************:"+ elab);
  count = count+1;
        }

//System.out.println("VALOR DO COUNT (ELABORADOR) ******************"+ count);
if(count==0){
      throw new wt.util.WTException(new Throwable(new String("Informe o Elaborador!")));
}

 

Thanks,

Felipe Oliveira


Viewing all articles
Browse latest Browse all 3592

Trending Articles



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