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
Version: Windchill 13.0
Use Case: We want to add some custom attributes to folders that we will need to modify during in certain cases.
Description:
Hello everyone,
I wanted to know if there is a way to make it possible to modify custom attributes for folders via API cause I'm having problem with a customization since I'm able to access only to the default "Description" attribute.
Thank you in advance
Solved! Go to Solution.
Hi @AK_10639313
Additional info.
Sometimes It is very useful to check the JavaDoc documentation to understand what the service can do.
PetrH
Hi @AK_10639313
Try the persistable adapter and PersistenceHelper
PersistableAdapter folderObj = new PersistableAdapter(persist, null, null, null);
folderObj.load("IBANAME", "name");
folderObj.set("IBANAME", "my value");
Object obj = folderObj.apply();
PersistenceHelper.manager.store(obj);
example also mentioned in https://www.ptc.com/en/support/article/CS149150?
replaced old api with new one> https://www.ptc.com/en/support/article/CS138252
PetrH
Sorry for the late reply and thank you a lot for sharing a possible solution,
I tried to do as you said but it didn't apply the changes on the attributes of the folder.
Yes I'm trying to get some intel on why it is not working, but I'm not being able to find examples on folders sadly.
From what I've been seeing the changes do apply when you modify an object in a working state. But you cannot do that to the Folder object.
Thanks again for your support,
much appraciated
Hi @AK_10639313
Trust me it has to work 😄
Ok. If the folder exists, then you can not use the Store helper method. So use modify
With store you could see error like this>
Also you could find that Object obj has to be cast to Persistable type
btw I've tested the code now and it works.
PersistableAdapter folderObj = new PersistableAdapter(fold, null, null, null);
folderObj.load("CREATESTATE");
folderObj.set("CREATESTATE", "my value");
Object obj = folderObj.apply();
PersistenceHelper.manager.modify((Persistable) obj);
I updated the iba attribute by my code.
PetrH
Hi @AK_10639313
Additional info.
Sometimes It is very useful to check the JavaDoc documentation to understand what the service can do.
PetrH
Hello @AK_10639313,
It looks like you have a response from a community member. If it helped you solve your question please mark the reply as the Accepted Solution.
Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.
Thanks,
Community Moderation Team.