PADFoundationloggingrun-trackingheadermetadatafoundationaudit

Run Header Initializer

Builds a structured run header with machine name, user context, flow name, and run ID. Outputs a formatted header block suitable for logging to file, database, or console. Pairs with Run Finalizer for complete run lifecycle tracking.

0 copies

Section 1: Capture Machine and User Context

PAD Script
1**REGION Capture Machine and User Context
2SET strRunId TO $'''REPLACE_WITH_RUN_ID'''
3SET strFlowName TO $'''REPLACE_WITH_FLOW_NAME'''
4System.GetEnvironmentVariable.GetEnvironmentVariable Name: $'''COMPUTERNAME''' Value=> strMachineName
5System.GetEnvironmentVariable.GetEnvironmentVariable Name: $'''USERNAME''' Value=> strUserName
6**ENDREGION

Section 2: Build Formatted Run Header

PAD Script
1**REGION Build Formatted Run Header
2DateTime.GetCurrentDateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateAndTime CurrentDateTime=> dtHeaderTime
3Text.ConvertDateTimeToText.FromCustomDateTime DateTime: dtHeaderTime CustomFormat: $'''yyyy-MM-dd HH:mm:ss''' Result=> strHeaderTimestamp
4SET strRunHeader TO $'''Run ID: %strRunId% | Flow: %strFlowName% | Machine: %strMachineName% | User: %strUserName% | Started: %strHeaderTimestamp%'''
5**ENDREGION

Usage Notes

  • Replace REPLACE_WITH_RUN_ID with the strRunId generated by the Variable Bootstrap pattern (e.g., RUN-20260320-143022)
  • Replace REPLACE_WITH_FLOW_NAME with a hard-coded literal string identifying your flow (e.g., $'''Invoice Processor''')
  • strRunHeader produces a single pipe-delimited line suitable for logging to file, Dataverse, or console output
  • Pairs directly with Run Finalizer — the header is written at flow start, the footer at flow end, creating a complete audit bracket
  • COMPUTERNAME and USERNAME are standard Windows environment variables available on all machines; no admin rights required
  • Use strRunHeader as the first entry written by Log Detail Writer so every log file begins with full execution context

Requirements

  • Windows environment with COMPUTERNAME and USERNAME environment variables set (standard on all Windows machines)
  • strRunId should already be initialized by the Variable Bootstrap pattern before this runs
  • No external dependencies — uses only built-in PAD System and DateTime actions
  • Flow must run in attended or unattended mode on a Windows machine (not cloud-only)