Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Update Item when lifecycle changes to Released API

0 REPLIES 0
Reply
Message 1 of 1
MatteoR_
381 Views, 0 Replies

Update Item when lifecycle changes to Released API

Hello there,

I'm designing a job which starts when I change an item lifecycle.

 

EntityId = Convert.ToInt64(job.Params["EntityId"]);
//drawing editing code
WebServiceManager wsm = context.Connection.WebServiceManager;
Item delBomItem = wsm.ItemService.EditItems(new long[] { EntityId }).FirstOrDefault();
wsm.ItemService.UpdatePromoteComponents(new long[] { delBomItem.RevId }, ItemAssignAll.Default, false);
DateTime timestamp;
GetPromoteOrderResults promoteOrder = wsm.ItemService.GetPromoteComponentOrder(out timestamp);
wsm.ItemService.PromoteComponents(timestamp, promoteOrder.PrimaryArray);
ItemsAndFiles itemsAndFiles = wsm.ItemService.GetPromoteComponentsResults(timestamp);
wsm.ItemService.UpdateAndCommitItems(new Item[] {delBomItem});



The job performs some editing to the table of the drawing included in the Item, so it checks out the document, edits it and then checks in it, so there is a new version of the drawing checked in Vault.


The point is, I need to update the Item because now I have a newer version of the drawing, but the Item is still referring to the previous one.
I tried with the following code to perform the update, but with no result.
The job server user has all the permissions needed as user and the protection policies needed to edit or update the Item in released state, in fact I can perform an "Update" from the Vault client successfully with the same user and the interface is not showing the "locked" icon.

I tried to launch the job when transitioning from Released to Editing, too, but I get the same exception thrown on line 5:

 

Errore: Eccezione SOAP ( mesg-id = 638328161687344961 )
Eccezione : EditItemRevisionFailed [1321] 
Traccia pila : 
Server stack trace: 
   in Connectivity.Product.BusinessLogic.ItemBL.EditItemRevisions(Int64[] itemRevIds, String comment)
   in System.Runtime.Remoting.Messaging.Message.Dispatch(Object target)
   in System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: 
   in System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   in System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   in Connectivity.Product.Services.ItemService.EditItemRevisions(Int64[] itemRevIds)
   in SyncInvokeEditItems(Object , Object[] , Object[] )
   in System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
   in System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
   in System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
   in System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
   in System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

Eccezione (interno): Non è possibile inserire il valore NULL nella colonna 'EntityID' della tabella 'Webcast.dbo.Locks'. La colonna non ammette valori Null. INSERT avrà esito negativo.
(Cannot insert NULL value in the column 'EntityID' of the table 'vaultname.dbo.Locks'. The column doesn't allow Null values. INSERT will have negative result.

Non è possibile eseguire il rollback di create_lock. Nessun punto di salvataggio o transazione con il nome specificato.

 



Am I passing the wrong value?
 
Thank you,
Regards

Matteo

 

 

Labels (6)
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report