Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
Hi everyone,
I have a little problem and I really hope someone can help me with that.
I created an EPMDocument by using an expression robot. Now I would like to automatically check-in this EPMDocument into the commonspace via a Java code, so that not only the person who created the document can see it in his workspace but also everyone else. I tried to use a method robot (for check in) for this, but that caused an error.
Can anyone please help me or point me in the right direction?
I'd really appreciate it.
Thanks,
Willi
Solved! Go to Solution.
I would recommend not to enter so much code into an expression robot. Call a java class from expression robot.
I wrote a small code that creates EPMDocument (works on 9.1 M40). Use it as reference for your use.
For check-in, you can use following API in expression robot itself. For you, object is EPMDoc and note is checkin comments.
wt.vc.wip.WorkInProgressHelper.service.checkin(Workable object, String note)
Side Note: If its a brand new EPMDocument, you might want to persist it. For you, obj is EPMDoc.
wt.fc.PersistenceHelper.manager.save(Persistable obj);
Thanks for the quick response.
Your answer does work, but unfortunately not for brand new EPMDocuments. After implementing the code and running it I get the following error:
wt.workflow.engine.FailedExpressionException: wt.util.WTException: (wt.vc.wip.wipResource/36) wt.vc.wip.WorkInProgressException:
WARNING: The element notebook - Layout, A.1 must be checked out in order to be checked in.
What should I do?
Thanks,
Willi
Did you happen to try this API?
wt.fc.PersistenceHelper.manager.save(Persistable obj);
Yes, I tried that API, but I still get the same warning. Element must be checked out in order to be checked in.
Maybe it's better to show you the hole code.
wt.epm.EPMContextHelper.setApplication(wt.epm.EPMApplicationType.toEPMApplicationType("EPM"));
wt.epm.EPMAuthoringAppType at = wt.epm.EPMAuthoringAppType.toEPMAuthoringAppType("PROE");
wt.epm.EPMDocumentType dt = wt.epm.EPMDocumentType.toEPMDocumentType("LAYOUT");
wt.query.QuerySpec qs = new wt.query.QuerySpec(wt.epm.workspaces.EPMWorkspace.class);
wt.epm.workspaces.EPMWorkspace workspace = null;
qs.appendWhere(new wt.query.SearchCondition(wt.epm.workspaces.EPMWorkspace.class,wt.epm.workspaces.EPMWorkspace.NAME,wt.query.SearchCondition.EQUAL,"the SPECIFIC WORKSPACE"),new int[] { 0 });
wt.fc.QueryResult qr = wt.fc.PersistenceHelper.manager.find((wt.pds.StatementSpec)qs);
System.out.println(qr.size());
while(qr.hasMoreElements())
{
workspace = (wt.epm.workspaces.EPMWorkspace)qr.nextElement();
}
epm=wt.epm.EPMDocument.newEPMDocument(number, name, app_type, doc_type, cad_name);
wt.inf.container.WTContainerRef container_ref = wt.inf.container.WTContainerRef.newWTContainerRef(workspace.getContainer());
wt.inf.container.WTContainerHelper.setContainer(epm, container_ref);
wt.folder.FolderHelper.assignLocation((wt.folder.FolderEntry) epm, workspace.getFolder());
wt.vc.wip.WorkInProgressHelper.service.checkin(epm, noteEpm)
wt.fc.PersistenceHelper.manager.save(epm);
Hopefully, you can tell me what is missing or wrong.
Thanks again,
Willi
I would recommend not to enter so much code into an expression robot. Call a java class from expression robot.
I wrote a small code that creates EPMDocument (works on 9.1 M40). Use it as reference for your use.
wow,
one more,
How to newEPMDocument set CreateDate ??
CreateDate in not today. i want another day.
Yogesh, How to upload a content file to the EPMDocument?
Thanks,
Raghu
Hi Yogesh,
i am facing one error while Uploading a modified content to a epmdcoument which is created by using API.
here is brief,
1. i have created an EPMDocumet by using API ( Simple .prt).
2. this EPMDocument is opening in Creo as well.
3. all actions like, check out, check in, undo check out , add to workspace from Browser are working fine.
4. checked out operation from creo also works fine.
5. now i have made some modifications in this epmdocumnet in creo.
7. now try to check in these modification in Windchill from creo - check in options.
8. here, before check in, it will upload this modification to server, but this upload operation was failing and ultimately i am not able to check in the epmdocument from creo.
here is my error,
Please help us to fix this issue.
Thanks, Vivek
Hi guyz,
I created workflow, which need to execute when EPMDocument checked in from PROE. I set Workflow in INWORK state of EPMDocument lifecycle.
I added synchronize robot on CHECKIN event of EPMDocument in workflow immediately after START , I added below code in synchronize robot that if EPMDocument path doesn't contain EPMDocument creator name then only proceed workflow .
However the workflow executes when I click SAVE & UPLOAD the Drawing in PROE, rather It should be executed when I click CHECK IN the Drawing.
So When I click CHECKIN , workflow doesn't execute Synchronize robot because it already executed ...
Does anybody have idea , How I can solve this issue?
primaryBusinessObject is EPMDocument
if ( primaryBusinessObject != null ) {
String stringCreator = ( (wt.epm.EPMDocument) primaryBusinessObject ).getCreatorName() ;
String stringForlderPath = ( (wt.epm.EPMDocument) primaryBusinessObject ).getFolderPath() ;
if( ! stringForlderPath.contains( stringCreator ) ) {
result = "ok";
}
}