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

object identifier for workflow object in Windchill 11.1 .

SumitDhar
8-Gravel

object identifier for workflow object in Windchill 11.1 .

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 .

 

SumitDhar_0-1653042310285.png

 

1 ACCEPTED SOLUTION

Accepted Solutions

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 

Preview
Finally saw this data model . It helped in digging deep in to the links.
SumitDhar_0-1653382198917.png

 

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());

 
 
 
 
 
 
 
 
 
 
 
 
 
 

View solution in original post

5 REPLIES 5

This is one way to get the info, using a report template:

joe_morton_0-1653333975874.png

 

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 

Preview
Finally saw this data model . It helped in digging deep in to the links.
SumitDhar_0-1653382198917.png

 

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

Announcements