Configure creation dialogs and tabs to display custom object data.
Requirements
Three components are required for custom object support:
By default, all three components are provided with Data Standard. These components are pre-configured to work with a custom object in Vault called Task.
Through the Vault configuration, create a custom object definition and call it Task.
Assign the Title and Description properties to the Base category.
Restart Vault Explorer and log into Vault two times:
The new custom object Task is fully initialized and ready to use.
Create a new custom object using the New command and name it anything you want.
Right-click on the new custom object. The context menu now shows New Task and Edit Task as menu options.
To define your own custom object, copy the three components from the Task sample and modify as needed.
Following are examples of a custom object called Person.
The context menu entries to create and edit a dialog are defined here:
%programdata%\Autodesk\<Vault version>\Extensions\DataStandard\Vault\MenuDefinitions.xml
The menu entry definitions must be created:
Copy the definitions (MenuItem NewTask, MenuItem EditTask) from the Task sample.
Replace Task with Person in all variables.
Modify Description, Hint, Label and Navigation Types.
<NewTask Label="CreatePerson..."
Description="New Person"
Hint="Create a new person object"
PSFile="CreateCustomObject.ps1"
Image="NewCustomObject.ico"
ToolbarPaintStyle="TextAndGlyph"
NavigationTypes="Person"
MultiSelectEnabled="false"/>
<EditTaskLabel="Edit Person..."
Description="Edit Person"
Hint="Edit a person object"
PSFile="EditCustomObject.ps1"
Image="EditCustomObject.ico"
ToolbarPaintStyle="TextandGlyph"
NavigationTypes="Task"
MultiSelectEnabled="False"/>
Next, create a menu site for the new custom object.
Copy the site (CommandSite Task) from the Task sample.
Replace Task with Person in all variables.
<TaskLabel="Person"
DeployAsPullDown="False"
Location="Person">
<ItemName="NewPerson">
</Item>
<ItemName="EditPerson">
</Item>
See Customize the Data Standard MenuDefiniftions.xml File for more details about the menu syntax.
The menu definitions in the MenuDefinitions.xml file point to powershell files. These files are located at %programdata%\Autodesk\<Vault version>\Extensions\DataStandard\Vault\addinVault\Menus.
The default CreateCustomObject.ps1 and EditCustomObject.ps1 powershell file work for every custom object. There is no need to create additional powershell files. However, it is still possible to customize and create powershell files for the new custom object by performing these tasks:
Copy the CreateCustomObject.ps1 and EditCustomObject.ps1 menu definition files and rename them as CreatePerson.ps1 and EditPerson.ps1.
Similar to other scripts, the create and edit custom object scripts point to a related XAML file.
Modify the XAML filename that defines the Data Standard dialog by replacing Task with Person.
...
$xamlFile = New-Object CreateObject.WPF.XamlFile "PersonXaml", "%ProgramData%\Autodesk\Vault 2016\Extensions\DataStandard\Vault\Configuration\Person.xaml"
$dialog.XamlFile = $xamlFile
...
The XAML file for the custom object create and edit dialog is specified in the PowerShell files (see above). By default, the XAML files for the create and edit dialogs as well as the tabs are located here:
%programdata%\Autodesk\<Vault version>\Extensions\DataStandard\Vault\Configuration
The default CustomObject.xaml works without any changes. However, you must use the CustomObject.xaml file as a template to create a XAML file for the new custom object.
Copy CustomObject.xaml file and name it Person.xaml.
Modify the new XAML file with these steps:
TaskWindow
with PersonWindow
.UIString[LBL61]
and UIString[LBL62]
.Change the following functions in %programdata%\Autodesk\<Vault version>\Extensions\DataStandard\Vault\addinVault\Default.ps1 by configuring:
InitializeWindow
to control the size of the dialog.GetCategories
to support dynamic properties based on categories.Validate
to implement validation rules.