Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
I need to check if a given Document has any documents in its Structure. Depending on it I have to route Workflow.
Solved! Go to Solution.
Hi Prasad,
You can use API to Navigates the WTDocumentUsageLink. It returns QueryResult of WTDocumentMaster.
QueryResult qr = WTDocumentHelper.service.getUsesWTDocumentMasters(doc);
Below is sample code snippet for your reference.
ObjectIdentifier oid = ObjectIdentifier.newObjectIdentifier("wt.doc.WTDocument:314514");
WTDocument doc = (WTDocument) PersistenceHelper.manager.refresh(oid);
QueryResult qr = WTDocumentHelper.service.getUsesWTDocumentMasters(doc);
while (qr.hasMoreElements()) {
WTDocumentMaster master = (WTDocumentMaster)qr.nextElement();
WTDocument latest = (WTDocument)wt.vc.VersionControlHelper.service.allVersionsOf(master).nextElement();
System.out.println("Identity -> " + latest.getDisplayIdentifier().getLocalizedMessage(Locale.ENGLISH) + " & State -> " + latest.getState());
}
I hope this helps you.
Regards,
Shirish
Hi Prasad,
You can use API to Navigates the WTDocumentUsageLink. It returns QueryResult of WTDocumentMaster.
QueryResult qr = WTDocumentHelper.service.getUsesWTDocumentMasters(doc);
Below is sample code snippet for your reference.
ObjectIdentifier oid = ObjectIdentifier.newObjectIdentifier("wt.doc.WTDocument:314514");
WTDocument doc = (WTDocument) PersistenceHelper.manager.refresh(oid);
QueryResult qr = WTDocumentHelper.service.getUsesWTDocumentMasters(doc);
while (qr.hasMoreElements()) {
WTDocumentMaster master = (WTDocumentMaster)qr.nextElement();
WTDocument latest = (WTDocument)wt.vc.VersionControlHelper.service.allVersionsOf(master).nextElement();
System.out.println("Identity -> " + latest.getDisplayIdentifier().getLocalizedMessage(Locale.ENGLISH) + " & State -> " + latest.getState());
}
I hope this helps you.
Regards,
Shirish