Community Tip - You can change your system assigned username to something more personal in your community settings. X
Version: Windchill 13.0
Use Case: In our customization, we use the SaveAsHelper class to duplicate some WTPart (and structure) and would like to "tag" the function used by setting a comment on the new WTPart, for example: "created by Copy Machine". Then it would be easier to track whether the SaveAs menu of Windchill was used or if the customization was used.
Description:
I cannot find a mean to set this comment/note on an pass it the the SaveAs function.
I have tried setting "iterationInfo.note" as attribute in the SaveAsObjectInfo, but without success (nor error message).
final HashMap<RevisionControlled, AbstractSaveAsObjectInfo> saveAsObjects = new HashMap<>();
for (WTPart wtPart : partsToCopy) {
final AutoNumberingHelper helper = new AutoNumberingHelper(containerRef);
final String newPartNumber = helper.getNumber(wtPart.getTypeDefinitionReference());
final Map<String, String> ibas = new HashMap<>();
// checkin Comment I try to set, but this has no visible effect.
ibas.put("iterationInfo.note", "created by Copy Line & Machines");
final AbstractSaveAsObjectInfo info = new PartSaveAsObjectInfo(newPartNumber, wtPart.getName(), folder,((WTContainer) containerRef.getObject()).getOrganization(), wtPart.getView(), null, ibas);
saveAsObjects.put(wtPart, info);
}
final SaveAsHelper saver = new SaveAsHelper(saveAsObjects, null);
saver.checkConflicts();
saver.invokeSaveAsPreActionEvent();
final Map<RevisionControlled, RevisionControlled> saveAsResult = saver.saveAs();Does someone have an Idea how to set the comment on the new object?
Solved! Go to Solution.
I thought comments were part of the Check-In process, have you looked there?
Let's have a try with the methods of EnterpriseService instead of SaveAsHelper... It allows to copy the object (but not save them), modify, them save them.
followed https://www.ptc.com/en/support/article/CS59135?source=search, but there are still other fields to set (Domain?) for the SaveAs to work.
I thought comments were part of the Check-In process, have you looked there?
Hi, yes, the comment is usually filled by checkout/checkin.
I find it a pity to first create some objects using SaveAs, then force a checkout/checkin only to set a comment explaining why (or how in my case) the object was created... I guess it is the way to go. 🙄
