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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Customizing save-as using CopyWTPartDelegate

dmcalister-2
14-Alexandrite

Customizing save-as using CopyWTPartDelegate

Version: Windchill 12.0

 

Use Case: Need to add logic to set the subtype of the wtpart based on an attribute value selected by the user on the save-as page.


Description:

Is it possible to get the attribute values selected by the user on the save-as page in the CopyWTPartDelegate? I have successfully extended the default CopyWTPartDelegate with some custom code, but I can't figure out how to get a string value that the user enters/selects on the save-as page for an attribute and use that value in my CustomCopyWTPartDelegate.

Article https://www.ptc.com/en/support/article/CS28799 states that custom attributes can be set on the save-as page since 12.0, and I have confirmed it. I have also seen that a listener approach may not work for this purpose: https://www.ptc.com/en/support/article/CS408331. I haven't tried it yet.

4 REPLIES 4

Anyone?  @HelesicPetr 

 

I've tried many things but still can't get the attribute values set on the save-as page. DefaultAttributeContainerHelper.getUnclonedAttributeValues from https://www.ptc.com/en/support/article/CS28799 doesn't return them. PTC TS said they can't help me.

Hi @dmcalister-2 

Iam not sure if you can get this information in this Delegate.

You need the request and command bean where this information is stored from the browser generaly.

 

I checked the default save as delegate and I can just say that this delegate just create a new instance of a source wtpart and nothing else.

The new parameters are pickup from specific isntruction in different class so if you don't find a way how to get the instructions in this delegate your request would be really hard to achieve.. For example create own save as function.

 

here is the place where you can find all information from the wizard with new values

it is saveAsInstructions variable that is in a com.ptc.windchill.uwgm.proesrv.action.AbstractSaveAsAction class.

HelesicPetr_0-1724313896693.png

You can try to create SaveAs helper and try to get instructions from this helper. But Iam not sure if this is possible to do from delegate class.

 

PetrH

 

  

Hi @dmcalister-2 

Just an idea, it would be easier to get a post save-as event and retype the WTPart to the subtype by the attribute as you need after the save-as operation.

And yes. you can do it.

PetrH

I was able to implement a listener that could get the new attribute value and retype the wtpart based on it. The one problem I have with this approach is that it already assigned the new number before any event I could listen for. I couldn't catch it before that. It looks like one of the first things it does is apply the number criteria from the oir. I have to then renumber the part because the subtype also determines the number series used.

 

Thanks for tracking down the SaveAsHelper and instructions. I saw instructions and thought I might explore that, but at this point, I'll probably just go with the listener that retypes and then renumbers.

 

By the way, that listener is tricky. In order to get the new attribute values set on the save-as page, you have to add a TransactionListener that waits for a commit before proceeding.

Announcements

Top Tags