The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.
How to get object identifier of workflow object on windchill object in 11.0 Ver ?
if we just enter a part / document number , we should be able to see workflow process assignment , creator details , etc .?
what exactly is missing is the how to get object identifier of any process associated with the object ? since if that is done we can fetch other details probably .
Solved! Go to Solution.
Hi HelesicPetr ,
Thanks for the response.
Actually, I needed to fetch from wtobject directly the processes / tasks associated . Those tasks which are added in the workflow not through change management
After gettting the process details , we can fetch tasks, assignee etc
Here is the code (remaining portion i have attached in previous mail chain )
wt.query.QuerySpec qs11 = new wt.query.QuerySpec(wt.workflow.work.WfAssignedActivity.class);
qs11.appendWhere(
new wt.query.SearchCondition(wt.workflow.work.WfAssignedActivity.class, "parentProcessRef.key.id",
wt.query.SearchCondition.EQUAL, proc.getPersistInfo().getObjectIdentifier().getId()));
wt.fc.QueryResult activitiesinWfblock = wt.fc.PersistenceHelper.manager.find(qs11);
while (activitiesinWfblock.hasMoreElements()) {
wt.workflow.work.WfAssignedActivity activity = (wt.workflow.work.WfAssignedActivity) activitiesinWfblock
.nextElement();
System.out.println("Activity Details :" + activity.getName());
Enumeration<WfAssignment> enumAct = activity.getAssignments();
while (enumAct.hasMoreElements()) {
WfAssignment e = (WfAssignment) enumAct.nextElement();
System.out.println("Activity Roles" + e.getAssignee() + " " + e.getStatus());
This is one way to get the info, using a report template:
The last link will be to whatever the Primary Business Object is for the Workflow
Hi ,
Thanks for the response .
I was looking for an API to get workflow process / running process from any object . I searched a lot , finally i have to switch to query spec as there is no such API.
Sharing the snippet , it may help someone for the same issue . This will bring in process linked to any object .
String wtRefString = null;
ReferenceFactory rf = new ReferenceFactory();
wtRefString = rf.getReferenceString(obj); // obj is part / document number given as argument entry //
System.out.println("wtRefString is " + wtRefString);
QuerySpec qs = new QuerySpec(WfProcess.class);
qs.appendWhere(new SearchCondition(WfProcess.class, WfProcess.BUSINESS_OBJ_REFERENCE, SearchCondition.EQUAL,
wtRefString), 0);
QueryResult qr = PersistenceHelper.manager.find(qs);
System.out.println("qrProcs size is " + (qr).size());
while ((qr).hasMoreElements()) {
WfProcess proc = (WfProcess) ((qr).nextElement());
Hi @joe_morton
API exists.
WorkflowCommands.getAssociatedProcesses(lcManaged, null, containerRef);
or if you search for tasks from object (ex. WTChangeActivity, WTChangeTask, WTChangeRequest, WTPromotionReq atc.), this can be also used with WTUser
WorkflowHelper.service.getWorkItems(persistObject);
Hope this can help
PetrH
Hi HelesicPetr ,
Thanks for the response.
Actually, I needed to fetch from wtobject directly the processes / tasks associated . Those tasks which are added in the workflow not through change management
After gettting the process details , we can fetch tasks, assignee etc
Here is the code (remaining portion i have attached in previous mail chain )
wt.query.QuerySpec qs11 = new wt.query.QuerySpec(wt.workflow.work.WfAssignedActivity.class);
qs11.appendWhere(
new wt.query.SearchCondition(wt.workflow.work.WfAssignedActivity.class, "parentProcessRef.key.id",
wt.query.SearchCondition.EQUAL, proc.getPersistInfo().getObjectIdentifier().getId()));
wt.fc.QueryResult activitiesinWfblock = wt.fc.PersistenceHelper.manager.find(qs11);
while (activitiesinWfblock.hasMoreElements()) {
wt.workflow.work.WfAssignedActivity activity = (wt.workflow.work.WfAssignedActivity) activitiesinWfblock
.nextElement();
System.out.println("Activity Details :" + activity.getName());
Enumeration<WfAssignment> enumAct = activity.getAssignments();
while (enumAct.hasMoreElements()) {
WfAssignment e = (WfAssignment) enumAct.nextElement();
System.out.println("Activity Roles" + e.getAssignee() + " " + e.getStatus());
Hi @joe_morton
Have you try it?
Does not matter what object you put there.
It can be WTDocument, WTPart, CAD Document. WTObjects are also WTChangeTask, WTChangeRequest atc.
Try it.
PetrH
I stumbled across this reply and it looks interesting for my purposes. Where can I see the documentation (i.e. JavaDoc) on the WorkflowCommands class? It is not in my Javadoc for 12.0.2.x... and this again leads to my repeated question "is there a complete JavaDoc somewhere?". I have to come to the community too often for this kind of help.
Hi @RFS
The documentation does not exist for non supported APIs .
What is not in the Windchill JavaDoc documentation it is not officially supported and not publicly documented.
Windchill PLM - Data Model - CS137012
PS: you can just use an java IDE as eclipse to search for the classes and methods.
PetrH