Variable - Set value from Script

Variables can be set from a value returned from an SQL or PowerShell script

workflow set variable from script

Silent workflow object This workflow object runs silently, meaning it has no user interaction.

Use

workflow set variable from database script

Script Title: This text will appear on the workflow canvas.

Script Type: Select SQL or Power Shell for the script type.

Description: Optional. This is meta-data only. Provide a description of this workflow step. This text will appear in the workflow panel when this workflow is the current workflow item.

Set results into this variable: Select a variable to store the result of the script. Choose a variable type that is appropriate to the expected result data type.

+: Create a new variable to store the returned value. See Creating Variables.

Script: Enter or paste the script that will return the value.

Format date variable as: Select UTC time or Local time for date variables used.

Extracting Dates Using Script

Dates can be extracted from the HelpMaster SQL database (stored in UTC time) using SQL script, or from Active Directory, EntraID and other sources using Powershell script. These dates can then be saved as Date Type or Text variables for use in Job Workflow, or saved to Control Set fields that can be seen and used directly from a Job.

SQL Dates

When extracting date/times from the HelpMaster database using Workflow, the date/times will be stored to the variable in UTC time, but is then converted to local time via the HelpMaster user interface. So no matter which time zone the user is in, they will see it in their local time.

PowerShell Dates

PowerShell dates may either be stored to the variable in local time or UTC depending upon the commands used to obtain the date/time values. See the commands below to store date/times to the variable in the desired format.

Return to local time format:

$localTime = Get-Date Write-Output $localTime

Return to UTC time format:

$utcDate = [DateTime]::UtcNow Write-Output $utcDate

Again the PowerShell date/times when stored to the variable in UTC time will be converted to local time via the HelpMaster user interface. So be displayed to the user in their local date/time format.

See also

Dates and Times

Workflow Variables Overview

Scripting - PowerShell

Workflow Overview

Workflow Objects

Use workflow variables in Email Templates

Send Email via Workflow