Skip to main content
12-Amethyst
November 30, 2022
Solved

Windchill Attribute value/OOTB Tab customization

  • November 30, 2022
  • 2 replies
  • 3013 views

I'm looking to add an action to the PrimaryContent attribute in General group under the Details Tab as shown in the attached image.

Just like how the PDF icon in the value downloads the PDF when clicked upon, I need to add another icon that performs an action.

Could anyone help me with it? Need API ways or any other workaround.

Best answer by HelesicPetr

Hi @MV_10441462 

You need to extend the PrimaryAttachmentPropertiesDataUtility.class 

then you need to generate standard DataValue from that class and in the end you generate own GuiComponent and add it to the final GuiArrayComponent.

 

Example of code is here

 

public class MultiComponentDataUtility extends PrimaryAttachmentPropertiesDataUtility //AssignmentsTableNmActionsDataUtility
{
	public Object getDataValue(String component_id, Object obj, ModelContext modelContext) throws WTException
	{
		// create original Component
		GUIComponentArray retObject = (GUIComponentArray) super.getDataValue(component_id, obj, modelContext);
		
		//example of menuaction from Workflow table so generate own nmAction used in the wf table
		AssignmentsTableNmActionsDataUtility actionDataUtility = new AssignmentsTableNmActionsDataUtility();
		NmAction nmAction = (NmAction) actionDataUtility.getDataValue(component_id, obj, modelContext);
		// crate new NmActionGuiComponent from nmAction that allows to add it to the GUIComponentArray
		NmActionGuiComponent nmActionGuiComponent = new NmActionGuiComponent(nmAction);
		// adding own custom NmActionGuiComponent to the finall array
		retObject.addGUIComponent(nmActionGuiComponent);

		return retObject;
	}
}

 

 

also do not forget to redefine the DataUtility in the enterprise.dataUtilities.properties to set your own custom datautility Class for primaryAttachmentProperties selector

 

PetrH

2 replies

avillanueva
23-Emerald I
23-Emerald I
November 30, 2022

I would think this can be done in one of two ways. It depends on how that URL to the content and the icons are generated. My guess is that its a data utility. We would need to find the right one and extend it. This would the allow you to add additional actions and icons next to the open content type icon. I checked jcaDebug quickly but it did not give me data on which one it was,

HelesicPetr
22-Sapphire II
22-Sapphire II
December 1, 2022

Hi @avillanueva 

DataUtility is com.ptc.windchill.enterprise.attachments.dataUtilities.PrimaryAttachmentPropertiesDataUtility

PetrH

HelesicPetr
22-Sapphire II
22-Sapphire II
December 1, 2022

Hi @MV_10441462 

Do you need something like following picture? 

 

HelesicPetr_0-1669901296244.png

 

PetrH

12-Amethyst
December 1, 2022

Hi @HelesicPetr Yes exactly. I need to add a similar icon next to the info icon on the PrimaryContent attribute value only for wt.doc.WtDocument types.

The icon when clicked will open a url that's generated dynamically.

HelesicPetr
22-Sapphire II
22-Sapphire II
December 1, 2022

Hi @MV_10441462 

You need to extend the PrimaryAttachmentPropertiesDataUtility.class 

then you need to generate standard DataValue from that class and in the end you generate own GuiComponent and add it to the final GuiArrayComponent.

 

Example of code is here

 

public class MultiComponentDataUtility extends PrimaryAttachmentPropertiesDataUtility //AssignmentsTableNmActionsDataUtility
{
	public Object getDataValue(String component_id, Object obj, ModelContext modelContext) throws WTException
	{
		// create original Component
		GUIComponentArray retObject = (GUIComponentArray) super.getDataValue(component_id, obj, modelContext);
		
		//example of menuaction from Workflow table so generate own nmAction used in the wf table
		AssignmentsTableNmActionsDataUtility actionDataUtility = new AssignmentsTableNmActionsDataUtility();
		NmAction nmAction = (NmAction) actionDataUtility.getDataValue(component_id, obj, modelContext);
		// crate new NmActionGuiComponent from nmAction that allows to add it to the GUIComponentArray
		NmActionGuiComponent nmActionGuiComponent = new NmActionGuiComponent(nmAction);
		// adding own custom NmActionGuiComponent to the finall array
		retObject.addGUIComponent(nmActionGuiComponent);

		return retObject;
	}
}

 

 

also do not forget to redefine the DataUtility in the enterprise.dataUtilities.properties to set your own custom datautility Class for primaryAttachmentProperties selector

 

PetrH