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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

How to Programmatically set Release Target for Resulting Objects

@_1647
11-Garnet

How to Programmatically set Release Target for Resulting Objects

Version: Windchill 12.0

 

Use Case: Requirement : Need to set Release Target Programmatically for Resulting Objects.


Description:

setTargetTrasition() is there but not getting a way to set Release Target.

  • Currently I have CN , CA and when I try to get change Record that time getting class cast exception for any object.
1 ACCEPTED SOLUTION

Accepted Solutions
HelesicPetr
22-Sapphire I
(To:@_1647)

Hi @_1647 

you should use the persistence manager to store the change. You just change it in the memory of the java transaction and it is not stored.

// save the change on the existing record
PersistenceHelper.manager.save(recordToUpdate);
// save the new record
PersistenceHelper.manager.store(newRecord);

PS: if you write a code in the workflow, you have to define full class definition

wt.fc.PersistenceHelper

PetrH

View solution in original post

7 REPLIES 7
VladimirN
24-Ruby II
(To:@_1647)

Article - "How to obtain programatically a Release Target (Transition) of a Changeable in a Change Notice in Windchill PDMLink": https://www.ptc.com/en/support/article/CS184486 

Thank you Vladimir for article.

That is for to get value not to set.

To set Release Target using setTargetTrasition().

But after setting the Transition as " CHANGE "on Wc UI changes are not reflecting.

Is there any method to save or propagate the changes which madhe on Change Record.

HelesicPetr
22-Sapphire I
(To:@_1647)

Hi @_1647 

It is really good idea to share some snip code. 

The class cast exception can be thrown because you expect some object type and use wrong retype object, but there is a different type. For example an Array. 

PetrH

To set Release Target using setTargetTrasition().

But after setting the Transition as " CHANGE "on Wc UI changes are not reflecting.

Is there any method to save or propagate the changes which madhe on Change Record.

HelesicPetr
22-Sapphire I
(To:@_1647)

Hi @_1647 

Sorry that I repeat my self 

It is really good idea to share your code. 

PetrH

  wt.fc.QueryResult links = wt.change2.ChangeHelper2.service.getChangeablesAfter(CA);           

while (links.hasMoreElements())

{            

wt.change2.ChangeRecord2 newChangeRecord = (wt.change2.ChangeRecord2) links.nextElement();       newChangeRecord.setTargetTransition(wt.lifecycle.Transition.CHANGE);             wt.lifecycle.Transition trans = newChangeRecord.getTargetTransition();             System.out.println("Release Target Transition is :" + trans.getDisplay());           }

HelesicPetr
22-Sapphire I
(To:@_1647)

Hi @_1647 

you should use the persistence manager to store the change. You just change it in the memory of the java transaction and it is not stored.

// save the change on the existing record
PersistenceHelper.manager.save(recordToUpdate);
// save the new record
PersistenceHelper.manager.store(newRecord);

PS: if you write a code in the workflow, you have to define full class definition

wt.fc.PersistenceHelper

PetrH

Top Tags