cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

APIs to save UsesOccurrenceUserIBAs soft attribute values

bfobar
4-Participant

APIs to save UsesOccurrenceUserIBAs soft attribute values

I've found how to retrieve them (CS130100) but I cannot figure out how to save the soft attribute value on the Part Uses Occurrence.  Anyone have an example?

 

Thanks.

3 REPLIES 3
bfobar
4-Participant
(To:bfobar)

TSE provided the solution, which I still could not find documentation for:

 

//orc is a PartUsesOccurrence object.
 
wt.occurrence.UsesOccurrenceUserIBAs iba=wt.occurrence.UsesOccurrenceUserIBAs.newUsesOccurrenceUserIBAs(orc);
 
com.ptc.core.lwc.server.LWCNormalizedObject obj = new com.ptc.core.lwc.server.LWCNormalizedObject(iba,null,java.util.Locale.US,new com.ptc.core.meta.common.UpdateOperationIdentifier());
 
//oiba01 is IBA name added into PartUsesOccurrence.
obj.load("oiba01");
obj.set("oiba01","setfromAPI");
obj.apply();
 
wt.fc.collections.WTKeyedMap usesOccurrencesAndData = new wt.fc.collections.WTKeyedHashMap();
wt.fc.collections.WTCollection relatedUsesOccurrenceData = new wt.fc.collections.WTArrayList(); relatedUsesOccurrenceData.add(iba);
usesOccurrencesAndData.put(orc, relatedUsesOccurrenceData);
 
wt.occurrence.OccurrenceHelper.service.saveUsesOccurrenceAndData(usesOccurrencesAndData);

 

Hope it helps someone else.

it is works!!!! thank you

Hi Ben,

Sorry to hear that you didn't exat documentation for this API. But I am also glad to hear that TS was able to get you some snippet here. 

I dig into this and found below knowledgebase articles around this (but not exactly the same). I hope this may help you somehow. 

https://support.ptc.com/appserver/cs/view/solution.jsp?n=116507

https://support.ptc.com/appserver/cs/view/solution.jsp?n=116504

https://www.ptc.com/en/support/article?n=CS162956

 

Regards,

Shirish

Top Tags