Data Standard Custom Objects Administration

Configure creation dialogs and tabs to display custom object data.

Requirements

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.

Note: Context menu support for custom objects is only available if a custom object exists.
  1. Through the Vault configuration, create a custom object definition and call it Task.
    Note: See Custom Objects Administration for more information.
  2. Assign the Title and Description properties to the Base category.
  3. 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.

  4. Create a new custom object using the New command and name it anything you want.
  5. Right-click on the new custom object. The context menu now shows New Task and Edit Task as menu options.
Note: When logging-in the first time after a new custom object has been defined, the file CustomEntityDefinitions.json (%programdata%\Autodesk\<Vault edition>\Extensions\DataStandard\Vault) is created. The definition in the file is used to initialize the tab and the menu items for the custom objects. The file should not be modified manually. To avoid users having to login several times, the file can be deployed. If you cannot initialize custom objects, the file can be deleted. It is created the next time you log into a vault.

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:

  1. Copy the definitions (MenuItem NewTask, MenuItem EditTask) from the Task sample.
  2. Replace Task with Person in all variables.
  3. 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.
  4. 	<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.

    1. Copy the site (CommandSite Task) from the Task sample.
    2. Replace Task with Person in all variables.
    3. <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:

  1. Copy the CreateCustomObject.ps1 and EditCustomObject.ps1 menu definition files and rename them as CreatePerson.ps1 and EditPerson.ps1.
  2. 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.

  1. Copy CustomObject.xaml file and name it Person.xaml.
  2. Modify the new XAML file with these steps:
    • Replace all occurrences of TaskWindow with PersonWindow.
    • 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] and UIString[LBL62].
    • Add or remove property controls as needed.
  3. 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

  1. Copy the Task folder and name it Person.
  2. If needed, update the Datasheet.xaml in the Person folder (e.g., add or remove properties).