I have Change Activity object and I wanted to get the latest task name (e.g. Correct, Complete)
So, How I can do it like wise?
Try reading these two articles and see if they can help you
it helps to understand all change objects relation ships good start.
if you need to get Workflow task you need to use following API
WTChangeActivity2 changeActivity = (WTChangeActivity2) qr.nextElement();
QueryResult qrWorkItems = WorkflowHelper.service.getWorkItems(changeActivity); // you can use different types of object as a input. ChangeRequest changeNotice, WTPart what object can have workflow.
WorkItem workItem = (WorkItem) qrWorkItems.nextElement();
WfActivity wfactivity = (WfActivity) workItem.getSource().getObject();
String activityName = wfactivity.getName();
Hope that can help
Also check another thread object-identifier-for-workflow-object-in-Windchill