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

The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.

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

 

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

7 REPLIES 7

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

HelesicPetr
22-Sapphire I
(To:SumitDhar)

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

 
 
 
 
 
 
 
 
 
 
 
 
 
 
HelesicPetr
22-Sapphire I
(To:SumitDhar)

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

RFS
11-Garnet
11-Garnet
(To:HelesicPetr)

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.

HelesicPetr
22-Sapphire I
(To:RFS)

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

HelesicPetr_0-1704265210602.png

PS: you can just use an java IDE as eclipse to search for the classes and methods. 

PetrH

Announcements

Top Tags