Skip to main content
13-Aquamarine
August 20, 2024
Solved

How to Programmatically set Release Target for Resulting Objects

  • August 20, 2024
  • 2 replies
  • 2780 views

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.
Best answer by HelesicPetr

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

2 replies

24-Ruby III
August 21, 2024

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 

@_164713-AquamarineAuthor
13-Aquamarine
August 21, 2024

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 II
22-Sapphire II
August 21, 2024

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

@_164713-AquamarineAuthor
13-Aquamarine
August 21, 2024

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.

@_164713-AquamarineAuthor
13-Aquamarine
August 21, 2024

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