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: 

Adding CommandSite After Vault Login

2 REPLIES 2
Reply
Message 1 of 3
jfaulkner-evolve
406 Views, 2 Replies

Adding CommandSite After Vault Login

Currently the API method which handles loading custom CommandSite actions occurs before the OnLogOn event. As such, at the time CommandSites must be defined, there is no knowledge of the Vault the user will connect to.

 

This creates a problem when dealing with custom objects across multiple Vaults as even objects with the same "Display Name" will have completely different "Name"s (GUID values). So if you have a common custom object, between two Vault databases (lets say "Company") and you want to bind a CommandSite to "Company" then you would have to know about both different Name GUIDs and create a CommandSite for both (so one of which would be garbage, depending). This creates a maintanance problem if you want to spin up a third Vault DB with the "Company" custom object functionality as you now have to create another CommandSite to GUID in the third database.

 

So is there a way you can create a CommandSite after you have logged into a Vault? More specifically, can you bind a CommandSite after you have a connected WebServiceManager object?

 

Something like this:

 

public void OnLogOn(IApplication application)
{
    var customObjects = application.Connection
.WebServiceManager.CustomEntityService
.GetAllCustomEntityDefinitions();     // Locate Company custom object.     var companyObject = customObjects         .FirstOrDefault(x => x.DispName == "Company");     if (companyObject != null)     {         var companySystemName = companyObject.Name;         // Create new CommandSite and bind it to
// the CompanySystemName for this Vault.
    }

// All custom object CommandSites now loaded. }
2 REPLIES 2
Message 2 of 3

Hi there, yep, you've found one! we had the same problem and solved by storing the display name and the GUID into an external configuration file. Basically not hard coding.

after logon we check wether GUID+display name are still valid for the current Vault. If not, we update the config file with the new GUID and gently ask the user to close and restart Vault.

So, i'm not aware of ways to create menu items after logon, which would make sense anyway as i'd like to add menu items differently for the according user.
Our workaround is to keep GUID configurable and have a login in the logon that checks if the GUID is still valid. if not, then update the GUID In the config and restart Vault.

hope this helps

ciao
marco
coolOrange
www.coolorange.com
Message 3 of 3

Marco, thank you for the reply.

Considering the limitations, your workaround sounds like the best which could be done at this point.

 

Fortunately, for my case at least, I found a solution.

The API function:

WebServiceManager.CustomEntityService.AddCustomEntityDefinition

Allows you to create a custom entity definition and specify the GUID (i.e. SystemName) associated with the new definition.

 

I created a generic extension which leverages this call so the customer now just needs to make sure they create new entity definitions via this interface and specify the exact GUID value when they want to leverage the customization. This way the GUID can be hardcoded into the source.

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

Post to forums  

Autodesk Design & Make Report