Hi,
Can anyone tell me how to get the tasks of a Changenotice/Change request/Change Task in java code.
for eg: "Complete ChangeNotice". I need to know the status of this task in the java code.
Thanks in advance.
Regards,
Archana.
Solved! Go to Solution.
Archana,
You can use changehelper2 to find related Object. once you have object then you get related process using
WfEngineHelper.service.getAssociatedProcesses API once you have process the use below API's to get the all activities/ workflow process task status
WTChangeOrder2 wtChangeOrder = (WTChangeOrder2) ref.getObject();
Enumeration processes = WfEngineHelper.service.getAssociatedProcesses(wtChangeOrder, null);
while (processes.hasMoreElements())
WfProcess process = (WfProcess) processes.nextElement();
NmOid nmOid = new NmOid(process);
QueryResult status = WorkflowCommands.getRouteStatus(nmOid);
}
Hope it helps!!!
Thanks
Shreyas
Hi Shreyas,
Thanks for the information.
QueryResult status = WorkflowCommands.getRouteStatus(nmOid);
Can u please let me know, what does this "getRouteStatus" referes to . To which object i need to typecast the "status" to the assigned tasks of the wprkflow.
Thanks in advance.
Regards,
Archana
Archana,
You can use below code to get more details
while (status.hasMoreElements()) {
Object obj = status.nextElement();
String activityName = "";
String assigne = "";
String role = "";
String comments = "";
String vote = "";
String actStatus = "";
String completed = "";
String start = "";
String signature = "";
String completedBy = "";
if (obj.getClass().isAssignableFrom(WorkItem.class)) {
WorkItem workitem = (WorkItem) obj;
activityName = ((WfAssignedActivity) workitem.getSource().getObject()).getName();
assigne = workitem.getOwnership().getOwner().getFullName();
role = workitem.getRole().getDisplay();
actStatus = new URLFactory().getHREF("/netmarkets/images/checked.gif");
} else if (obj.getClass().isAssignableFrom(Element.class)) {
continue;
} else if (obj.getClass().isAssignableFrom(WfVotingEventAudit.class)) {
WfVotingEventAudit wfVotingEventAudit = (WfVotingEventAudit) obj;
activityName = wfVotingEventAudit.getActivityName();
assigne = wfVotingEventAudit.getAssigneeRef().getFullName();
role = ((wfVotingEventAudit.getRole() == null) ? "" : wfVotingEventAudit.getRole().getDisplay());
comments = wfVotingEventAudit.getUserComment();
vote = wfVotingEventAudit.getEventList().toString();
actStatus = new URLFactory().getHREF("/netmarkets/images/checked.gif");
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
completed = ((wfVotingEventAudit.getTimestamp()) == null) ? "" : dateFormat.format(wfVotingEventAudit.getTimestamp());
start = ((wfVotingEventAudit.getCreateTimestamp()) == null) ? "" : dateFormat.format(wfVotingEventAudit.getCreateTimestamp());
completedBy=wfVotingEventAudit.getUserRef().getName();
signature = getSignature((WTUser) wfVotingEventAudit.getUserRef().getObject());
}
}
let me know if this helps.
Thanks
Shreyas
Hi Shreyas,
Thanks a lot It has helped me ..
Thank u
Regards,
Archana
Hi Archana,
Can you mark the answer as correct to help other community members
REgards,
Bhushan