Data Standard Custom Objects Administration
Configure creation dialogs and tabs to display custom object data.
Requirements
Three components are required for custom object support:
- Menu entries for the create and edit dialog.
- Dialog files (.xaml) for the dialogs and tabs.
- Scripting files (PowerShell) for the dialog logic.
Use Pre-Configured Custom Object "Task"
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.
Note: See Custom Objects Administration for more information.Assign the Title and Description properties to the Base category.
Restart Vault Explorer and log into Vault two times:
- The first time you log in, check that the Tasks object type is available in the Vault Client.
- Log out and log in a second time to initialize the Datasheet tab and the menu items to create and edit Tasks.
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.
Configure Additional Custom Objects
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.
Menu Entries
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.
Note: For these variables, the UIString syntax in the original sample can be used. See Localization for more information.<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.
Scripting Files
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 ...
Dialogs and Tab
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:
- Replace all occurrences of
TaskWindow
withPersonWindow
. - Correct the dialog title by adding New Person and Edit Person Datasheet to the UiStrings.xml and replacing the IDs with the IDs for the new text strings
UIString[LBL61]
andUIString[LBL62]
. - Add or remove property controls as needed.
- Replace all occurrences of
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.
Get a Datasheet tab for the new custom object
- Copy the Task folder and name it Person.
- If needed, update the Datasheet.xaml in the Person folder (e.g., add or remove properties).