Update Description (Item,CO) item property does not work (API)

Update Description (Item,CO) item property does not work (API)

Anonymous
Not applicable
2,376 Views
6 Replies
Message 1 of 7

Update Description (Item,CO) item property does not work (API)

Anonymous
Not applicable

Hi.
I'm trying to update the system description of an Item, but I get an error 3339 "UpdatePropertiesFailed".

This is my code:

 

//VAULT PROPERTIES

var ItemPropertyCompletamento = "(C)Completamento";

var ItemPropertyDescriptionIT = "Description (Item,CO)";

var ItemPropertyDescriptionEN = "(C)Descrizione Inglese";

var entityClassId = "ITEM";

 

//MY VALUES

var status = "10";

var descIT = "PROVA";

var descEN = "TEST";


//Create new Item

var item = connection.WebServiceManager.ItemService.AddItemRevision(category.Id);

connection.WebServiceManager.ItemService.UpdateAndCommitItems(new[] { item });

 

//Edit Item

var editItem = connection.WebServiceManager.ItemService.EditItems(new [] { item.RevId }).First();

 

var prtDefs = connection.WebServiceManager.PropertyService.GetPropertyDefinitionsByEntityClassId(entityClassId);

//Update "(C)Completamento"

var prtDef = prtDefs.GroupBy(ps => ps.Id).Select(p => p.First()).Single(p => p.DispName.ToUpper().Equals(ItemPropertyCompletamento.ToUpper()) || p.SysName.ToUpper().Equals(ItemPropertyCompletamento.ToUpper()));

connection.WebServiceManager.ItemService.UpdateItemProperties(new[] { editItem.revId }, new[] { prtDef.Id }, new[] { status });

 

//Update "(C)Descrizione Inglese"

var prtDef = prtDefs.GroupBy(ps => ps.Id).Select(p => p.First()).Single(p => p.DispName.ToUpper().Equals(ItemPropertyDescriptionEN.ToUpper()) || p.SysName.ToUpper().Equals(ItemPropertyDescriptionEN.ToUpper()));

connection.WebServiceManager.ItemService.UpdateItemProperties(new[] { editItem.revId }, new[] { prtDef.Id }, new[] { descEN });

 

//Update "Description (Item,CO)"

var prtDef = prtDefs.GroupBy(ps => ps.Id).Select(p => p.First()).Single(p => p.DispName.ToUpper().Equals(ItemPropertyDescriptionIT.ToUpper()) || p.SysName.ToUpper().Equals(ItemPropertyDescriptionIT.ToUpper()));

connection.WebServiceManager.ItemService.UpdateItemProperties(new[] { editItem.revId }, new[] { prtDef.Id }, new[] { descIT });

 

connection.WebServiceManager.ItemService.UpdateAndCommitItems(new [] { editItem });

 

All works fine, except for the last one.
Could you help me please?

Thank you very much.
Andrea

 

 

 

0 Likes
Accepted solutions (1)
2,377 Views
6 Replies
Replies (6)
Message 2 of 7

manuel.lanthaler
Enthusiast
Enthusiast

Hi Andrea,

 

properties in Vault are either System properties or User Defined Properties (UDPs). The main difference is that UDPs values can be edited directly, and system property values are set by the system and can not be added or deleted.

 

Therefore its not possible to directly change the value of Description (Item,CO)  via UpdateItemProperties since it is a system property.

 

 

Manuel

coolOrange
www.coolOrange.com
––––––––––––––––––
Please mark this response as "Accept as Solution" if it answers your question.
If you have found any post to be helpful, even if it's not a direct solution, then please provide that author kudos.


0 Likes
Message 3 of 7

Anonymous
Not applicable

Hi Manuel.

Ok I could use another property, but is not there a work around?
Can I use a different function to change the item description?
I have to synchronize this item property from ERP system to Vault. 

I know that Autodesk does not support direct access to the Database, but if there is no solution .........


Thank you.

Best Regards.

Andrea


Man And Machine
www.mum.it

0 Likes
Message 4 of 7

minkd
Alumni
Alumni

You can update the description of an item with the UpdateAndCommitItems method in the Item service.

 

-Dave



Dave Mink
Fusion Lifecycle
Autodesk, Inc.
0 Likes
Message 5 of 7

Anonymous
Not applicable

Hello Dave.

In my first post, I wrote that I was not able to update the Item Description Property.
I was using connection.WebServiceManager.ItemService.UpdateAndCommitItems(new [] { editItem }) method, as you mentioned, but I am still getting an error.

It is impossible for me updating that property.

Thanks in advance.

B.R.
Andrea De Giorgi
Man And Machine Software
www.mum.it


 

0 Likes
Message 6 of 7

minkd
Alumni
Alumni
Accepted solution

You are trying to change the description via UpdateItemProperties - that will not work as it is a system property (as Manuel mentioned). You have to set the description in the ItemRevision object(s) that are passed to UpdateAndCommitItems.

 

-Dave



Dave Mink
Fusion Lifecycle
Autodesk, Inc.
0 Likes
Message 7 of 7

Anonymous
Not applicable

Sorry Dave, I did not understand!
I created a new ItemRevision object passing vault connection and webServiceItem parameters and I found the item property "Description".
I setted it and executed UpdateAndCommitItems method.
All worked fine!

Thank you very much.

Andrea De Giorgi
Man And Machine Software
www.mum.it

0 Likes