<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Auto associate doesn't apply WTPart subtype defaults in Windchill Customization</title>
    <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Auto-associate-doesn-t-apply-WTPart-subtype-defaults/m-p/1039005#M10623</link>
    <description>&lt;P&gt;Version: Windchill 13.0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use Case: Autoassociate preference is turned on and a custom class that extends DefaultAutoAssociatePartFinderCreator implements AutoAssociatePartFinderCreator runs to select the correct subtype based on Product context. Autoassociate created WTParts don't have the particular subtype defaults.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;Description: &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;I customized the AutoAssociatePartFinderCreator class to look at the product context a CAD document is being checked into and based on the context selects the appropriate subtype of WTPart to auto associate.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This works as expected and the correct WTPart subtype is associated on check in based on context name.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, the subtype defaults and cascading attribution I set up for that particular subtype doesn't carry over. Instead, it looks as though the WTPart subtype is created based on the default parent WTPart.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I create a new part in the context, it follows the WTPart subtype attributes and defaults I set up.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to have the auto-associated part use the defaults for that WTPart subtype??&lt;/P&gt;</description>
    <pubDate>Fri, 17 Oct 2025 18:32:11 GMT</pubDate>
    <dc:creator>Dobi</dc:creator>
    <dc:date>2025-10-17T18:32:11Z</dc:date>
    <item>
      <title>Auto associate doesn't apply WTPart subtype defaults</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Auto-associate-doesn-t-apply-WTPart-subtype-defaults/m-p/1039005#M10623</link>
      <description>&lt;P&gt;Version: Windchill 13.0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use Case: Autoassociate preference is turned on and a custom class that extends DefaultAutoAssociatePartFinderCreator implements AutoAssociatePartFinderCreator runs to select the correct subtype based on Product context. Autoassociate created WTParts don't have the particular subtype defaults.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;Description: &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;I customized the AutoAssociatePartFinderCreator class to look at the product context a CAD document is being checked into and based on the context selects the appropriate subtype of WTPart to auto associate.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This works as expected and the correct WTPart subtype is associated on check in based on context name.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, the subtype defaults and cascading attribution I set up for that particular subtype doesn't carry over. Instead, it looks as though the WTPart subtype is created based on the default parent WTPart.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I create a new part in the context, it follows the WTPart subtype attributes and defaults I set up.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to have the auto-associated part use the defaults for that WTPart subtype??&lt;/P&gt;</description>
      <pubDate>Fri, 17 Oct 2025 18:32:11 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/Auto-associate-doesn-t-apply-WTPart-subtype-defaults/m-p/1039005#M10623</guid>
      <dc:creator>Dobi</dc:creator>
      <dc:date>2025-10-17T18:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: Auto associate doesn't apply WTPart subtype defaults</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Auto-associate-doesn-t-apply-WTPart-subtype-defaults/m-p/1039977#M10654</link>
      <description>&lt;P&gt;Hi &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/618552"&gt;@Dobi&lt;/a&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thank you for your question.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Your post appears well documented but has not yet received any response. I am replying to raise awareness. Hopefully, another community member will be able to help.&lt;BR /&gt;&lt;BR /&gt;Also, feel free to add any additional information you think might be relevant.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;</description>
      <pubDate>Fri, 24 Oct 2025 14:50:55 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/Auto-associate-doesn-t-apply-WTPart-subtype-defaults/m-p/1039977#M10654</guid>
      <dc:creator>Catalina</dc:creator>
      <dc:date>2025-10-24T14:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: Auto associate doesn't apply WTPart subtype defaults</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Auto-associate-doesn-t-apply-WTPart-subtype-defaults/m-p/1039988#M10655</link>
      <description>&lt;P&gt;Hi Dobi,&lt;/P&gt;&lt;P&gt;There should be an issue with your custom code as the propagation of the&amp;nbsp;com.ptc.windchill.uwgm.common.autoassociate.DefaultAutoAssociatePartFinderCreator#createNewWTPart is using&amp;nbsp;com.ptc.windchill.uwgm.common.autoassociate.WTPartUtilities#createNewPart, which does the copy, is carrying the subtype attributes.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Oct 2025 15:22:50 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/Auto-associate-doesn-t-apply-WTPart-subtype-defaults/m-p/1039988#M10655</guid>
      <dc:creator>MTH</dc:creator>
      <dc:date>2025-10-24T15:22:50Z</dc:date>
    </item>
    <item>
      <title>Re: Auto associate doesn't apply WTPart subtype defaults</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Auto-associate-doesn-t-apply-WTPart-subtype-defaults/m-p/1040020#M10658</link>
      <description>&lt;P&gt;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/963047"&gt;@MTH&lt;/a&gt;&amp;nbsp;I'm happy to admit that this is an issue with my code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I followed this:&amp;nbsp;&lt;A href="https://www.ptc.com/en/support/article/CS135305" target="_blank" rel="noopener"&gt;CS135305.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I define some call outs for my particular subtypes as called out in Type and Attribute Management.&lt;/P&gt;
&lt;LI-CODE lang="java"&gt;// WCTypeIdentifier defaultWCType = (WCTypeIdentifier) defaultType;
public static final String ONE_WTPART_TYPE = "com.something.www.oneWTPart";
public static final String TWO_WTPART_TYPE = "com.something.www.twoWTPart";&lt;/LI-CODE&gt;
&lt;P&gt;I then override the `createNewPart` bit:&lt;/P&gt;
&lt;LI-CODE lang="java"&gt;// Set the appropriate part type based on product context
try {			
   if (containerName.contains("one")) {
      part.setTypeDefinitionReference(TypedUtilityServiceHelper.service.getTypeDefinitionReference(ONE_WTPART_TYPE));
			} else {
	part.setTypeDefinitionReference(TypedUtilityServiceHelper.service.getTypeDefinitionReference(TWO_WTPART_TYPE));
			}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Am I wrong in assuming that by specifying the subtype in this way would pull the parent WTPart template?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Oct 2025 19:59:55 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/Auto-associate-doesn-t-apply-WTPart-subtype-defaults/m-p/1040020#M10658</guid>
      <dc:creator>Dobi</dc:creator>
      <dc:date>2025-10-24T19:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Auto associate doesn't apply WTPart subtype defaults</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Auto-associate-doesn-t-apply-WTPart-subtype-defaults/m-p/1040553#M10665</link>
      <description>&lt;P&gt;PTC tech support suggests this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"&lt;SPAN data-olk-copy-source="MessageBody"&gt;Creating a WTPart using the API may not automatically apply the default attribute values defined in Type and Attribute Management. However, you can use the PersistableAdapter API to set these values manually, as described in&amp;nbsp;&lt;A href="https://www.ptc.com/en/support/article/CS135663" target="_blank" rel="noopener"&gt;CS135663&lt;/A&gt;".&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a number of cascading attributes in this subtype and it seems kind of blah to have to redo all of that in the API... at the very least it renders the autoassociate customization moot because the end result is a different part type but all the same attribution as the part type I can create on autoassociate anyways without the customization. So I'm not convinced this is the way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Oct 2025 14:10:21 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/Auto-associate-doesn-t-apply-WTPart-subtype-defaults/m-p/1040553#M10665</guid>
      <dc:creator>Dobi</dc:creator>
      <dc:date>2025-10-28T14:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: Auto associate doesn't apply WTPart subtype defaults</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Auto-associate-doesn-t-apply-WTPart-subtype-defaults/m-p/1043102#M10733</link>
      <description>&lt;P&gt;I'm still discussing with PTC Tech support but what is turning out to be true is:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Autoassociate (&lt;A href="https://www.ptc.com/en/support/article/CS135305" target="_blank" rel="noopener"&gt;CS135305&lt;/A&gt;) DOESN'T FOLLOW DEFAULTS set in either Type and Attribute manager or OIRs (they suggested&amp;nbsp;&lt;A href="https://www.ptc.com/en/support/article/CS389217" target="_blank" rel="noopener"&gt;CS389217&lt;/A&gt;)&lt;/LI&gt;
&lt;LI&gt;Suggestion was to add a PersistableAdapter bit of code in the autoassociate class as specified here -&amp;nbsp;&lt;A href="https://www.ptc.com/en/support/article/CS135663" target="_blank" rel="noopener"&gt;CS135663&lt;/A&gt;. However, it appears as though the point in which this would get added doesn't YET have the WTPart created and associated to the CAD that is triggering the autoassociation. This results in a null pointer exception.&lt;/LI&gt;
&lt;/UL&gt;
&lt;LI-CODE lang="java"&gt;// create part with super class
WTPart part = super.createNewWTPart(partDescriptor);

// Set the appropriate part type based on product context
try {			
   if (containerName.contains("one")) {
   part.setTypeDefinitionReference(TypedUtilityServiceHelper.service.getTypeDefinitionReference(ONE_WTPART_TYPE));

Folder folder = WorkInProgressHelper.service.getCheckoutFolder();
System.out.println("Part is: " + part);
part = (WTPart) WorkInProgressHelper.service.checkout(part, folder, "").getWorkingCopy();
PersistableAdapter obj = new PersistableAdapter(part, null, Locale.US ,new UpdateOperationIdentifier());
				obj.load("myAttribute");
				obj.set("myAttribute", "value");
				part = (WTPart) obj.apply();
				part = (WTPart) PersistenceHelper.manager.modify(part);
				WorkInProgressHelper.service.checkin(part, "");
				&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The point at which the PersistableAdapter is trying to edit the value, there's not yet a part:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dobi_0-1762978385102.png" style="width: 400px;"&gt;&lt;img src="https://www.ptcusercommunity.com/t5/image/serverpage/image-id/131032iB3AA63C5A3B0FC8A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Dobi_0-1762978385102.png" alt="Dobi_0-1762978385102.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are there any other approaches?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Nov 2025 20:14:33 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/Auto-associate-doesn-t-apply-WTPart-subtype-defaults/m-p/1043102#M10733</guid>
      <dc:creator>Dobi</dc:creator>
      <dc:date>2025-11-12T20:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: Auto associate doesn't apply WTPart subtype defaults</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill-Customization/Auto-associate-doesn-t-apply-WTPart-subtype-defaults/m-p/1044122#M10743</link>
      <description>&lt;P&gt;PTC tech support to the rescue (thank you Sandeep!)&lt;/P&gt;
&lt;P&gt;For the persistableAdapter to work, the OperationIdentifier and OperationIdentifierConstants.&amp;lt;PROTOCOL&amp;gt; are needed for defaults to be set on autoassociate.&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="java"&gt;// create part with super class
WTPart part = super.createNewWTPart(partDescriptor);
		
// Set the appropriate part type based on product context
try {			
    if (containerName.contains("one")) { part.setTypeDefinitionReference(TypedUtilityServiceHelper.service.getTypeDefinitionReference(ONE_WTPART_TYPE));
    OperationIdentifier oi = OperationIdentifier.newOperationIdentifier(OperationIdentifierConstants.CREATE_SKIP_OIRS);
     PersistableAdapter obj = new PersistableAdapter(part, null, Locale.US, oi);
     obj.load("myAtr1", "myAtr2");
     obj.set("myAtr1", "value1");
     obj.set("myAtr2","value2");
     obj.apply();
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Nov 2025 01:48:39 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill-Customization/Auto-associate-doesn-t-apply-WTPart-subtype-defaults/m-p/1044122#M10743</guid>
      <dc:creator>Dobi</dc:creator>
      <dc:date>2025-11-20T01:48:39Z</dc:date>
    </item>
  </channel>
</rss>

