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. }
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.