Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Translate the entire conversation x

How to make ready only "Name & Number" attributes on Part Edit Common Attribute Page

WT_010219
10-Marble

How to make ready only "Name & Number" attributes on Part Edit Common Attribute Page

Version: Windchill 12.1

Use Case: I want make ready only "Name & Number" attributes on Part Edit Common Attribute Page :

Description:

LB_10619520_0-1737024600816.png

I am unable to figure if I should use data utility or Validator for this.

1. I tried data utility but I didn't triggered as I am able to registered data utility ID since there is no such Edit Common Attribute layout.

 

public class DisableName extends DefaultDataUtility {
	protected static final Logger logger = LogR.getLogger(DisableName.class.getName());
	@Override
	public UIValidationStatus getDataValue(String filedName, Object object, ModelContext modelContext)
			throws WTException {
		System.out.println("---- DisableName on Part CommonAttribute Started-------------");
		UIValidationStatus status = UIValidationStatus.ENABLED;
		System.out.println("---- filedName :" + filedName);
		
		if (modelContext.getDescriptorMode().equals(ComponentMode.EDIT)) {
			if (filedName.equalsIgnoreCase("name")|| filedName.equalsIgnoreCase("number") ) {
				System.out.println("---- filedName available ");
				status = UIValidationStatus.ATTR_HIDDEN_VALUE;
			}
		}
		System.out.println("---- returning status : " + status);
		return status;
	}
}

 

2. I tried extending EditPartCommonAttrsActionValidator and used preValidateAttribute, but It also didn't got triggered..

 

public class PartEditCommonAttributeValidator extends EditPartCommonAttrsActionValidator {
	@Override
	public UIValidationStatus preValidateAttribute(UIValidationKey var1, UIValidationCriteria var2) {
		UIValidationStatus status = super.preValidateAttribute(var1, var2);
		System.out.println("---- PartEditCommonAttributeValidator Validator Started-------------");
		Persistable launchedFrom = var2.getContextObject().getObject();
		System.out.println("launchedFrom" + launchedFrom);
		System.out.println("validationKey : " + var1);
		status = UIValidationStatus.ATTR_HIDDEN_VALUE;
		System.out.println("---- Validator Status : " + status);
		return status;
	}
}

 

Can you please help to get correct methodology to implement my requirement. 

Thank you in advance.

4 REPLIES 4

There are some ACLs that may apply here. See: https://www.ptc.com/en/support/article/CS23471?source=search

 

Thank you @joe_morton  , I will check

Fadel
22-Sapphire II
(To:WT_010219)

You can do tha Oo TB t from UI : 

 

In type and attribute manager find these attributes on WTPartMaster and set visibility to read only on edit  : 

Fadel_1-1737055064793.png

 

Fadel_0-1737055025033.png

 

 

wrsDoc.mp4
Video Player is loading.
Current Time 0:00
Duration 0:00
Loaded: 0%
Stream Type LIVE
Remaining Time 0:00
 
1x
    • Chapters
    • descriptions off, selected
    • captions off, selected
      (view in My Videos)

      Fede
      WT_010219
      10-Marble
      (To:Fadel)

      Thank you @Fadel 

       

      I works for other attribute as you show but not foe name & number. I want to do it for name & number.

      LB_10619520_0-1737112197160.png

       

      Thanks you.

      Announcements
      Top Tags