Hi Martin,
you can use a file numbering scheme to number COs as well.
In this example the name of the numbering scheme simply equals the category of the object. With that you can even have separate numbering schemes for different COs, e.g. Request, Classes, etc...
2 Steps are required: 1) filter available numering schemes according your category and 2) use this scheme to create the number
1) filter
function GetNumSchms {
..... add the lines to the default function.... after the $list is filled:
#Filter list or share it, according required dialog/category=numschm type
$mWindowName = $dsWindow.Name
switch($mWindowName)
{
"FileWindow"
{
$Global:NumSchmsList = $list
}
"FolderWindow"
{
$Global:NumSchmsList = $list
}
"CustomObjectWindow"
{
$mCat = $dsWindow.FindName("Categories").SelectedValue.Name
$list = $list |? { $_.Name -eq $mCat}
$dsWindow.FindName("NumSchms").SelectedIndex = 0
}
default
{
#$list = $list |? { $_ -eq $UIString["MSDCE_Num03"]}
$dsWindow.FindName("NumSchms").SelectedIndex = 0
}
}
return $list
}
2) Create new name - if numbering scheme exists, it will be used, if not - just use the title as name
function GetNewCustomObjectName {
$dsDiag.Trace("--GetNewObjectName Default=all categories---")
IF($dsWindow.Findname("NumSchms").SelectedIndex -eq 0) {
#$objectName = GenerateObjectNumber
$Prop["_XLTN_IDENTNUMBER"].Value = GenerateObjectNumber #fill the (readonly) field
}
$objectName = $dsWindow.FindName("txtName").Text
$dsDiag.Trace("--- txtName returns $objectName ")
IF ($objectName -eq "") {
$objectName = $Prop["_XLTN_TITLE"].Value
$dsDiag.Trace("--- Title gets the new object name")
}
$dsDiag.Trace("--- GetNewCustomObjectName returns $objectName")
return $objectName
}
We are sharing a full featured example environment "Vault 2016 Quickstart" with our channel partners/resellers. Let me know, in case you don't get access to it.
Regards,
Markus
Markus Koechl
Solutions Engineer PDM, Autodesk Central Europe