If I have an Item as a record on a Change Order in Vault Pro 2012, is there a way to add/remove an attachment for that Item with the API?
In the VaultAPI help under Class Item - Properties, there is ControlledByChangeOrder as Boolean. The description says "If true, item is being controlled by a Change Order and certain properties cannot be manually changed."
What are those "certain properties"?
Can an Item be temporarily removed from a Change Order, add/remove the attachment, and then added back on? This would break the ability to Roll-back the Lifecycle state for the Item in the ECO though so I want to avoid that.
Any ideas?
I will accept it can't be done as a valid answer if that is the case. I'll use the ControlledByChangeOrder property to output an error log.
Hi,
I asked a colleague about this. Here is the reply:
>> >>
If I have an Item as a record on a Change Order in Vault Pro 2012, is there a way to add/remove an attachment for that Item with the API?
You can add and remove attachments on Items using either the UpdateAndCommitItem() or the UpdateItem() methods on the ItemService. Each of the methods has a parameter named Attachments that is an array of Attmt objects. Use these methods to update the item to remove or add attachments. Remember, though, that you need to first get an editable instance of the Item you want to edit by calling EditItem() on the ItemService.
In the VaultAPI help under Class Item - Properties, there is ControlledByChangeOrder as Boolean. The description says "If true, item is being controlled by a Change Order and certain properties cannot be manually changed."
What are those "certain properties"?
I’m not sure exactly which properties are prevented from being modified. I believe adding attachments to an item solely depends on the lifecycle state of the item (which can be controlled by change orders if their vault is configured that way). As far as I’m aware (from messing around a bit), things like the item’s lifecycle state and effectivity are affected, but attachments are not. It would probably be easiest to simply set up an item with a change order and one without and try editing them the way you intend to and see if these actions are permitted.
Can an Item be temporarily removed from a Change Order, add/remove the attachment, and then added back on? This would break the ability to Roll-back the Lifecycle state for the Item in the ECO though so I want to avoid that.
You can add and remove items from a change order using the UpdateChangeOrder() method on the ChangeOrderService. The parameters you’ll be interested in are the addItemMasterIds and the delItemMasterIds. These parameters are both arrays of longs. By adding the master Id of the item you want to add/remove to the appropriate array, you can update the items associated with the change order. You must first call EditChangeOrder() from the ChangeOrderService to get an editable change order, though. I believe whether or not you can update a change order is dependent upon its lifecycle state, too.
Any ideas?
I will accept it can't be done as a valid answer if that is the case. I'll use the ControlledByChangeOrder property to output an error log.
I’ve done very limited playing around with the above API methods. I think what would be best is to just play around in Vault Explorer to determine under which scenarios it might not work to simply update the item. It doesn’t strike me as a great idea to remove the item from the change order just to add and attachment and then add it back to the change order again. Vault explorer typically behaves by displaying the restriction you get from the server and let the user correct the situation. More information on change orders and items can be found on the wiki here: http://wikihelp.autodesk.com/Vault/enu/Help/Help/0001-Using_Va1/0034-Work_wit34/0036-Manage_C36.
<< <<
Thanks,
Thanks for the reply. I was thinking about this more. Could it be possible that because an Item on a Change Order cannot be edited that the Change Order itself needs to be put in an editable state first?