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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Programmatically find latest votes for user on change task

TWil24
7-Bedrock

Programmatically find latest votes for user on change task

Is there anyway to pull the latest assignment from a user on a particular assignment using java? Currently, I'm working on a report that displays the votes of each user that has been assigned an assignment. However, when it get's re-subrouted, the code I have currently does not know which vote was the latest so it will display "old" votes.

 

I'm currently working on code that attempts to find the latest timestamp of an assignment's creation and use it but even that's becoming messy.

2 REPLIES 2
avillanueva
22-Sapphire I
(To:TWil24)

I did this slightly differently using eSignatures. Each time I loop through, signature history was cleared so there was only 1 set to find.

QueryResult result=PersistenceHelper.manager.navigate(ecn,SignatureLink.SIGNATURE_ROLE,SignatureLink.class,false);

This was against a Change Notice. If you are using the esignature check box, those capture votes as well

SignatureLink link=null;
while(result.hasMoreElements()) {
link=(SignatureLink)result.nextElement();

link.getVote().

You should be able to get user, role and date from this object. I hope this helps.

HelesicPetr
21-Topaz II
(To:TWil24)

Hello @TWil24 ,

 

I needed to get comments similar way how you need the votes with users.

I wrote code for worflow transiction Start where I needed to show to user previous comments of users who wanted more information

I didn't sort the results because they follow that what is first in iterator is last 

 

Code


wt.fc.collections.WTArrayList auditCol = (wt.fc.collections.WTArrayList) wt.workflow.engine.WfEngineHelper.service.getVotingEvents((wt.workflow.engine.WfProcess)((wt.workflow.work.WfAssignedActivity)self.getObject()).getParentProcess(), null, null, null);
System.out.println("***Transition Expression: Audit = " + auditCol.toString());
Integer comentnumber=0;
java.util.Iterator auditEvents0 = auditCol.persistableIterator();
//here I need to know how many times the Clarify transaction is done.
while( auditEvents0.hasNext())
{
wt.workflow.engine.WfVotingEventAudit audit1 = (wt.workflow.engine.WfVotingEventAudit)auditEvents0.next();
if(audit1.getEventList().toString().equalsIgnoreCase("[Clarify]")) // string name of transation name
{
comentnumber = comentnumber +1;
}
}
java.util.Iterator auditEvents = auditCol.persistableIterator();
String comments = "";
while( auditEvents.hasNext())
{
wt.workflow.engine.WfVotingEventAudit audit = (wt.workflow.engine.WfVotingEventAudit)auditEvents.next();
System.out.println("***Transition Expression: User vote = " + audit.getEventList());
System.out.println("***Transition Expression: User comment = " + audit.getUserComment());
if(audit.getEventList().toString().equalsIgnoreCase("[Clarify]")){
comments += comentnumber+ ". comment - " + audit.getUserRef().getName() + ": " + audit.getUserComment() + "\n"; // here you can use getEventList()
comentnumber=comentnumber-1;
System.out.println("***Transition Expression: Complete Time = " + audit.getPersistInfo().getCreateStamp());
}
}
System.out.println("comments = " + comments);
String special_instructions1 = comments;

 results in a task page in instructions:

HelesicPetr_0-1641992582425.png

HelesicPetr_1-1641992872417.png

 

Top Tags