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

Promotion and Workflow Issue

SOLVED
Highlighted

Promotion and Workflow Issue

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

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Promotion and Workflow Issue

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

3 REPLIES 3

Re: Promotion and Workflow Issue

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

Re: Promotion and Workflow Issue

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

Re: Promotion and Workflow Issue

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.