Skip to content

Event Handlers & Automation

Overview

Event handlers are automations that execute when specific capture actions occur. They enable Capture to trigger downstream processes, send notifications, update systems, and integrate with workflows.


Event Types

Capture supports three event types:

On Submit

Triggers: When a user submits a capture

Use for:

  • Send notification emails
  • Create tasks in project management systems
  • Log submission in external database
  • Update file metadata
  • Trigger subsequent processes

Available for: Submit and Approve/Reject submission types


On Approve

Triggers: When a reviewer approves a capture

Use for:

  • Publish approved documents
  • Update file lifecycle states
  • Send approval confirmation
  • Trigger downstream workflows
  • Update quality systems

Available for: Approve/Reject submission type only


On Reject

Triggers: When a reviewer rejects a capture

Use for:

  • Return files to original state
  • Create feedback task for submitter
  • Send rejection notification
  • Log rejection reason
  • Trigger rework workflows

Available for: Approve/Reject submission type only


Handler Types

Capture supports two types of event handlers:

Legacy: PowerShell Scripts

Overview:

  • Custom PowerShell code executed on MinuteView server
  • Direct access to Vault APIs and system resources
  • Inline code editor in Console

Capabilities:

  • Full PowerShell language support
  • Access to MinuteView PowerShell modules
  • Vault API integration
  • File system operations
  • External API calls

Limitations:

  • Harder to maintain and debug
  • Requires PowerShell knowledge
  • Inline editing only
  • Less integration with MinuteView workflows

Overview:

  • Triggers existing MinuteView workflows
  • Visual workflow designer
  • Better integration and maintainability

Capabilities:

  • All MinuteView workflow features
  • Visual design and debugging
  • Version control
  • Reusable across templates
  • Better error handling

Advantages:

  • ✅ Easier to maintain
  • ✅ Better debugging tools
  • ✅ Visual design
  • ✅ Integrated with MinuteView workflow system
  • ✅ Recommended for new implementations

Configuring Event Handlers

Using PowerShell (Legacy)

  1. Open Capture Template in Console
  2. Navigate to Event Handlers or Automation section
  3. Select event type (Submit, Approve, Reject)
  4. Choose PowerShell Script
  5. Write or paste PowerShell code in editor
  6. Test script
  7. Save template configuration

Using Workflows (Modern)

  1. Create workflow in MinuteView Workflows module (or select existing)
  2. Open Capture Template in Console
  3. Navigate to Event Handlers or Automation section
  4. Select event type (Submit, Approve, Reject)
  5. Choose Workflow
  6. Select workflow from dropdown
  7. Configure workflow parameters (if any)
  8. Save template configuration

Common Event Handler Scenarios

Scenario 1: Email Notification on Submit

Goal: Send email when capture is submitted

PowerShell Approach:

powershell
# Get capture details
$captureName = $Capture.Name
$submitter = $Capture.CreatedBy

# Send email
Send-MailMessage `
    -To "reviewer@company.com" `
    -From "minuteview@company.com" `
    -Subject "New Capture: $captureName" `
    -Body "A new capture has been submitted by $submitter"

Workflow Approach:

  • Create workflow with "Send Email" node
  • Configure email template
  • Assign to On Submit event

Scenario 2: Update File States on Approve

Goal: Change Vault file states when capture approved

PowerShell Approach:

powershell
# Get artifacts from capture
$artifacts = $Capture.Artifacts

# Update each file state in Vault
foreach ($artifact in $artifacts) {
    $file = Get-VaultFile -FileId $artifact.FileId
    Update-VaultFileState -File $file -NewState "Released"
}

Workflow Approach:

  • Create workflow with "Update Vault File State" nodes
  • Configure state transition
  • Handle each artifact in loop
  • Assign to On Approve event

Scenario 3: Create Task on Reject

Goal: Create rework task when capture rejected

PowerShell Approach:

powershell
# Get rejection details
$rejector = $Capture.Reviewer
$comments = $Capture.Comments
$submitter = $Capture.CreatedBy

# Create task in project system (example API call)
Invoke-RestMethod `
    -Uri "https://tasks.company.com/api/tasks" `
    -Method Post `
    -Body @{
        title = "Address Rejected Capture"
        assignedTo = $submitter
        description = "Comments: $comments"
    }

Workflow Approach:

  • Create workflow with "Create Task" node
  • Configure task details from capture data
  • Assign to On Reject event

Scenario 4: Publish Documents on Approve

Goal: Copy approved files to document control folder

PowerShell Approach:

powershell
# Get approved artifacts
$artifacts = $Capture.Artifacts
$destinationPath = "\\server\docs\approved\"

foreach ($artifact in $artifacts) {
    # Download from Vault
    $file = Get-VaultFile -FileId $artifact.FileId
    $localPath = Download-VaultFile -File $file

    # Copy to document control
    Copy-Item $localPath "$destinationPath\$($file.Name)"
}

Workflow Approach:

  • Create workflow with "Export Files" nodes
  • Configure destination paths
  • Handle each artifact
  • Assign to On Approve event

Available Data in Event Handlers

Event handlers have access to capture data:

Capture Object

  • $Capture.Id - Unique capture identifier
  • $Capture.Name - Capture name/title
  • $Capture.TemplateName - Template used
  • $Capture.CreatedBy - User who created capture
  • $Capture.CreatedDate - When capture was created
  • $Capture.Status - Current status
  • $Capture.Comments - User comments

Fields

  • $Capture.Fields["FieldName"] - Access custom field values
  • Example: $projectCode = $Capture.Fields["Project Code"]

Artifacts

  • $Capture.Artifacts - Array of associated artifacts
  • Each artifact has: FileId, FileName, FilePath, Version, State

Event-Specific Data

On Approve/Reject:

  • $Capture.Reviewer - Who approved/rejected
  • $Capture.ReviewDate - When review occurred
  • $Capture.ReviewComments - Reviewer comments

PowerShell CMDlets

MinuteView provides PowerShell modules with CMDlets for common operations:

Vault Operations

  • Get-VaultFile - Retrieve file information
  • Update-VaultFileState - Change file lifecycle state
  • Download-VaultFile - Download file locally
  • Upload-VaultFile - Upload file to Vault
  • Get-VaultFileProperties - Get file metadata

Capture Operations

  • Get-CaptureDetails - Retrieve capture information
  • Update-CaptureField - Modify capture field value
  • Get-CaptureArtifacts - Get list of artifacts
  • Add-CaptureComment - Add comment to capture

Notification

  • Send-CaptureNotification - Send email notification
  • Send-TeamsNotification - Send Microsoft Teams message

System Integration

  • Invoke-RestMethod - Call external APIs
  • Invoke-WebRequest - HTTP requests
  • Standard PowerShell CMDlets

Best Practices

Choose the Right Tool

  • Use workflows for new implementations
  • Use PowerShell only when workflows can't meet the need
  • Consider maintainability and supportability

Error Handling

PowerShell:

powershell
try {
    # Your automation code
    Update-VaultFileState -File $file -NewState "Released"
}
catch {
    # Log error
    Write-Error "Failed to update file state: $_"
    # Optionally notify admin
}

Workflows:

  • Use error handling nodes
  • Configure retry logic
  • Set up failure notifications

Testing

  1. Test in non-production - Use test templates and captures
  2. Test all paths - Submit, Approve, Reject scenarios
  3. Test edge cases - Missing data, errors, timeouts
  4. Monitor logs - Check execution logs after testing

Performance

  • Keep handlers efficient
  • Avoid long-running operations in handlers
  • Consider async workflows for time-consuming tasks
  • Monitor execution times

Security

  • Least privilege - Event handlers should have minimal necessary permissions
  • Audit access - Log what handlers do
  • Protect credentials - Don't hardcode passwords
  • Validate input - Don't trust capture data blindly

Troubleshooting

Event Handler Not Triggering

Check:

  • Is handler configured in template?
  • Is event type correct (Submit vs Approve vs Reject)?
  • Is template active?
  • Check MinuteView logs for errors

PowerShell Errors

Check:

  • Syntax errors in script
  • Missing modules or CMDlets
  • Permission issues
  • Check execution logs

Debugging:

  • Add Write-Output statements
  • Use try/catch blocks
  • Check PowerShell event logs
  • Test script independently

Workflow Not Executing

Check:

  • Is workflow valid and published?
  • Are workflow inputs configured correctly?
  • Check workflow execution logs
  • Verify workflow permissions

Performance Issues

Symptoms:

  • Captures slow to submit/approve
  • Timeouts
  • System lag

Solutions:

  • Optimize handler code
  • Move long operations to async workflows
  • Add timeout handling
  • Monitor system resources

Migration from PowerShell to Workflows

If you have existing PowerShell event handlers and want to migrate to workflows:

Migration Process

  1. Document current PowerShell - What does it do?
  2. Design equivalent workflow - Map PowerShell steps to workflow nodes
  3. Create and test workflow - Build in workflow designer
  4. Update template - Switch from PowerShell to workflow
  5. Test thoroughly - Verify same functionality
  6. Monitor - Watch initial executions closely

Common Conversions

PowerShell OperationWorkflow Node
Send-MailMessageSend Email
Update-VaultFileStateUpdate File State
Copy-ItemExport Files
Invoke-RestMethodHTTP Request
ForEach loopFor Each Loop

Advanced Integration

Multiple Event Handlers

Some configurations allow chaining handlers:

  • Handler 1: Update files
  • Handler 2: Send notification
  • Handler 3: Create tasks

Execution order matters—configure appropriately.

Conditional Logic

PowerShell:

powershell
if ($Capture.Fields["Priority"] -eq "High") {
    # Send urgent notification
}
else {
    # Standard notification
}

Workflows:

  • Use conditional branches
  • Decision nodes based on capture data

External System Integration

Integrate with:

  • ERP systems
  • Project management tools (Jira, Monday.com)
  • Document management systems
  • Custom databases
  • APIs and web services

Next Steps

Your configuration is complete! Continue with:

Tentech