Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hello!
I'm trying to update name for EPMDocuments using the below code:
EPMDocumentMaster master = getMaster();
LWCNormalizedObject lwcObject = new LWCNormalizedObject(master,null,Locale.US,new UpdateOperationIdentifier());
lwcObject.load("name");
lwcObject.set("name", "newValue");
lwcObject.apply();
PersistenceHelper.manager.modify(master);
The above code fails with below exception:
com.ptc.core.meta.container.common.ConstraintException: The value for Name cannot be changed. Constraint Violation in isUpdateValid()
com.ptc.core.meta.container.common.impl.DefaultConstraintValidator.isUpdateValid(DefaultConstraintValidator.java:199)
com.ptc.core.meta.container.common.impl.BasicAttributeContainer._put(BasicAttributeContainer.java:2819)
com.ptc.core.meta.container.common.impl.BasicAttributeContainer._put(BasicAttributeContainer.java:2627)
com.ptc.core.meta.container.common.impl.BasicAttributeContainer.put(BasicAttributeContainer.java:947)
com.ptc.core.meta.type.common.impl.DefaultTypeInstance.put(DefaultTypeInstance.java:1023)
com.ptc.core.lwc.server.LWCNormalizedObject.set(LWCNormalizedObject.java:441)
The below code works but is hideously slow:
EPMDocumentMasterIdentity id = EPMDocumentMasterIdentity.newEPMDocumentMasterIdentity(master);
id.setName("newValue");
IdentityHelper.service.changeIdentity(master, id);
My question is if anyone knows how to change name for EPMDocuments in a fast and efficient way?
Preferably I would like to use the first piece of code working.
Maybe some kind of property needs to be set?
Thanks and best regards,
Peter
Guess you have more luck if you post this question in the windchill section.
http://communities.ptc.com/community/windchill?view=discussions
Thanks!
I will try that!
/Peter