Vault Customization

Reply
Contributor
orbjeff
Posts: 19
Registered: ‎08-15-2011
Message 1 of 3 (213 Views)
Accepted Solution

Assign Property to a Category

213 Views, 2 Replies
03-01-2012 12:36 PM

Using the Vault 2012 API, I am able to create a new category and property definition. I'd like to then assign this new property definition to my new category.

 

Maybe another way to say this is that I want to make my new property a behavior of my new category. I've searched the API document and this forum but I can't figure out how to do that.

 

1.) Is this possible through the API?

2.) If yes which service and method would I use?

 

Thank you,

 

Jeff

Jeff Johnson
Technical Consultant
DataWorks MGI | a division of MasterGraphics Inc.
Employee
Redmond.D
Posts: 795
Registered: ‎12-12-2006
Message 2 of 3 (199 Views)

Re: Assign Property to a Category

03-05-2012 09:52 AM in reply to: orbjeff

Yes, you can assign property definitions to a category through the API.  It's not a very intuitive set of functions.

 

 

Background:

A category is a collection of behaviors. A behavior is just a piece of functionality. Currently a category can have 3 types of behaviors: lifecycle definitions, revision schemes, and property definitions. In your case, it's the property definition behavior that you want to edit.

 

Solution:

The function you need to call is UpdateCategoryBehaviorAssignmentTypes in the CategoryService.

Here is what you do for each parameter:

categoryId - The ID of the category you are editing

behaviorClassName - pass in "UserDefinedProperty"

allowNoBehavior - I don't think this parameter applies to the property behavior. Vault Explorer passes in YES so you should do that too.

behaviorIds - pass in an array of all property definition IDs you want associated with this category. Since you are adding a prop def you need to pass in an array of all existing prop definitions with the new prop definition added.  (see next section)

behaviorAssignTypes - Again, I don't think this applies to categories. Just pass in an array of DEFAULT since that is what Vault Explorer does.

disableAllThenApply - Pass in TRUE here.

 

Finding the existing property definitions on a category:

GetCategoryConfigurationById should give you what you want. Pass in the category ID and tell it you want the UserDefinedProperty behavior.

It will give you back a CatCfg object which has the information you need. The BhvCfgArray[0].BhvArray property will be an array of all the existing property definition IDs for that category.



Doug Redmond
Software Engineer
Autodesk, Inc.
http://justonesandzeros.typepad.com/

Contributor
orbjeff
Posts: 19
Registered: ‎08-15-2011
Message 3 of 3 (156 Views)

Re: Assign Property to a Category

04-20-2012 04:28 AM in reply to: Redmond.D

Doug,

 

Thanks for your help and the additional write up (with code) on your blog page. For anyone else interested its located here:

 

http://justonesandzeros.typepad.com/blog/2012/03/setting-the-properties-on-a-category.html

 

 

Jeff Johnson

 

Jeff Johnson
Technical Consultant
DataWorks MGI | a division of MasterGraphics Inc.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community