Skip to main content
18-Opal
December 27, 2017
Solved

Promotion and Workflow Issue

  • December 27, 2017
  • 2 replies
  • 2703 views

Hi, I am a beginner.

 

If there are objects checked out during the promotion process, the process will generate an error.
So I want to add an expression that checks to see if the object that initiates the promotion process is checked out.
Tell us which api, class i should use

 

Also, I would like to add code to be automatically revised when I make a change request.
The element that will be automatically revised is the object associated with the change request.

 

I really need to your help.
Help me please


Thank you.

 

from ChaSeonHo

Best answer by ShirishMorkhade_238755

Hello ChaSeonHo,

 

I remember I had this kind of workflow customization to check if objects are checked out. To do this, I used below code snippet. 

 

while(qr.hasMoreElements())
{
 wt.fc.WTObject obj = (wt.fc.WTObject) qr.nextElement();
 boolean pisCheckedOut = wt.vc.wip.WorkInProgressHelper.isCheckedOut((wt.vc.wip.Workable)obj);
 //System.out.println("SeedObjectIdentity:" + obj.getDisplayIdentity());
 if (pisCheckedOut)
 {
 java.lang.Exception pe = null;
 pe = new Exception(obj.getDisplayIdentity() + " is checked out. Please ensure all objects are checked in before completing your task.");
 //System.out.println(obj.getDisplayIdentity()+ " is checked out. Please ensure all objects are checked in before completing your task.");
 throw new wt.workflow.engine.FailedTransitionException ( pe );
 }
}

I hope this helps you.

 

Regards,

Shirish

2 replies

16-Pearl
December 27, 2017

Hello ChaSeonHo,

 

I remember I had this kind of workflow customization to check if objects are checked out. To do this, I used below code snippet. 

 

while(qr.hasMoreElements())
{
 wt.fc.WTObject obj = (wt.fc.WTObject) qr.nextElement();
 boolean pisCheckedOut = wt.vc.wip.WorkInProgressHelper.isCheckedOut((wt.vc.wip.Workable)obj);
 //System.out.println("SeedObjectIdentity:" + obj.getDisplayIdentity());
 if (pisCheckedOut)
 {
 java.lang.Exception pe = null;
 pe = new Exception(obj.getDisplayIdentity() + " is checked out. Please ensure all objects are checked in before completing your task.");
 //System.out.println(obj.getDisplayIdentity()+ " is checked out. Please ensure all objects are checked in before completing your task.");
 throw new wt.workflow.engine.FailedTransitionException ( pe );
 }
}

I hope this helps you.

 

Regards,

Shirish

CHASEONHO18-OpalAuthor
18-Opal
January 3, 2018

Thanks!
i solved by your snippet code.
but i forgot feedback
cause ptc site was drop till yesterday so i couldn't login
i really appreciate your answer

jbailey
18-Opal
January 3, 2018

I would consider looking at the "CM" Picture before you decided to have a change request automatically create new revisions of objects.  Out of the box, the change request is designed to identify affected objects and propose a change.  The Change Notice is the plan, who will complete it, what objects will change, and what they will change to in the affected items table.  If you revise objects and decide not to do anything with them you could create a headache if someone uses the revised files in a model (because by default creo will grab the latest file).  Once that new assembly uses the revised model, the revised model cannot be deleted unless the assembly iteration using it is also deleted.