Skip to main content
1-Visitor
August 2, 2013
Solved

Check in new EPMDocument with Windchill API's

  • August 2, 2013
  • 2 replies
  • 9842 views

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

Best answer by ybagul

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.

2 replies

1-Visitor
August 2, 2013

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

MaBau1-VisitorAuthor
1-Visitor
August 2, 2013

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

1-Visitor
August 2, 2013

Did you happen to try this API?

wt.fc.PersistenceHelper.manager.save(Persistable obj);

1-Visitor
February 27, 2015

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";

}

}