Settings dialog: settings are lost on environments with multiple jobProcessors

Issue

On environments with multiple powerJobs Processors that have different job types, Job trigger settings for jobs that are unique for one powerJobs Processor are lost after editing the powerJobs Settings dialog on the other machine

Solutions

There are multiple workarounds for this issue:

Solution 1

Add an empty job script on the environment where the job is missing that has the same name as the job on the other jobProcessor machine. The script must contain the correct entity type:

# JobEntityType = FILE

Solution 2

Queue the job via powerEvents customization by registering an event and adding the job to the queue in the event script. In this example a PDF is added on file state change:

Register-VaultEvent -EventName UpdateFileStates_Post -Action 'PostUpdateFileStates'

function PostUpdateFileStates($files, $successful) {
foreach ($file in $files) {
$job = Add-VaultJob -Name "Sample.CreatePDF" -Parameters @{"EntityId"=$file.EntityId;"EntityClassId"="FILE"} -Description "Job for creating PDF"
}
}  

Context menu buttons can also be added via powerEvents customization. This example adds a button to queue the sample PDF job in the file context menu

Add-VaultMenuItem -Location FileContextMenu -Name "Create PDF" -Action {
param($entities)
foreach($file in $entities){
       $file = Get-VaultFile -File $file._FullPath
Add-VaultJob -Name "Sample.CreatePDF" -Parameters @{"EntityId"=$file.Id; "EntityClassId"="File"} -Description "Create PDF for: $($file._Name)" -Priority 10
}
}

Solution 3

Use the Vault configuration to trigger the job on lifecycle transition.

With this solution the job can not added as button to a context menu

See Also

powerEvents VaultEvents

Add-VaultMenuItem

Add-VaultJob