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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

How to Programmatically set Release Target for Resulting Objects

@_1647
12-Amethyst

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.
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

13 REPLIES 13
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 

@_1647
12-Amethyst
(To:VladimirN)

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

@_1647
12-Amethyst
(To:HelesicPetr)

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

@_1647
12-Amethyst
(To:HelesicPetr)

  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

@_1647
12-Amethyst
(To:HelesicPetr)

Hi @HelesicPetr 

I need one more help from you that,

How can we programmatically get the comments from resulting item table because we don't get that in change record and not on objects as well.

@_1647
12-Amethyst
(To:@_1647)

Sorry @HelesicPetr 

wrong question asked we can get that as description

 

HelesicPetr
22-Sapphire I
(To:@_1647)

@_1647 

I wanted to write it :D. Use jcaDebug it is a description

HelesicPetr_0-1724419406670.png

so 

HelesicPetr_1-1724419437363.png

 

PetrH

 

 

@_1647
12-Amethyst
(To:HelesicPetr)

Yes that was wrong question actually.

Now I am struggling to get formatted text 

@_1647
12-Amethyst
(To:@_1647)

Actually question was how or HTMLTextFilter works to get formatted description in report because I am using htmltExtFilter.filterHtMLText();

But it's not working getting description with html tags like <p><\p>etc

HelesicPetr
22-Sapphire I
(To:@_1647)

Hi  @_1647 

Actually I would start a new thread for your question. PS> formatted text from what?

PetrH

Announcements
Top Tags