Jobs are not updating Vault files randomly

Sometimes the file conversion jobs are not updating the target Vault file, but terminate without error

Cause

Currently there is an issue in the Add-VaultFile cmdlet where it returns a file object even though the target file is checked out by another user.

So even if a job has a condition to check whether a file object has been returned it will never be executed.

Solution

Add a check at the start of your job to see if the target file is checked out by another user. As the target file can't be updated in this situation it safes time to exit the job as early as possible, before doing time consuming stuff like starting Inventor.

For example in the Sample.CreatePDF job this could look like this:

if ($pdfNetworkFolder -and -not (Test-Path $pdfNetworkFolder)) {
  throw("The network folder '$pdfNetworkFolder' does not exist! Correct pdfNetworkFolder in ps1 file!")
}

 to

if ($pdfNetworkFolder -and -not (Test-Path $pdfNetworkFolder)) {
  throw("The network folder '$pdfNetworkFolder' does not exist! Correct pdfNetworkFolder in ps1 file!")
}

$originalPdfFile = Get-VaultFile -File "$pdfVaultFolder/$pdfFileName"
$checkedOutByOtherUser = $originalPdfFile -and $originalPdfFile.IsCheckedOut -and ($originalPdfFile._CheckoutUserName -ne $vaultConnection.UserName)
if($checkedOutByOtherUser) {
  throw "The file '$pdfVaultFolder/$pdfFileName' is currently checked out by other user '$($originalPdfFile._CheckoutUserName)'"
}