Follow

Programming using the workflow context object

The workflow context is passed to all custom workflow steps using the $ctx standard parameter.  The underlying .NET type of the object is the PowershellContext class contained in assembly emDash.Workflow.Step.Interface.dll.  This class is fully documented in the emdash help file (which is found under "C:\emdash\help\emdash.Help.chm" on your emdash Server).

The context provides access to system and environment wide settings, the emdash data model and logging framework.

Accessing System and environment wide settings

  • GetEnvironmentWideSettingByName - gets the value of an environment wide setting.   A default value can be set and the option to check the environment wide setting option if there is no environment specific setting in place.
  • GetSystemWideSettingByName - gets the value of a system wide setting.

Logging

  • LogProgress - logs a progress message to the job leg for this step
  • LogDebug - Log a debug message to the job log. The message is only logged if the <root><level value = "DEBUG" /></root> in the log4net.config file of the emdash workflow service is set to DEBUG.  
  • LogError - Log an error message to the job log.  This will appear in red text in the job log user interface.
  • LogException - Log an exception to the job log.

Accessing the emdash data model

  • TargetEnvironment - the target environment for the job - this is selected on the create job page.
  • TargetApplication - the target application for the job - this is selected on the create job page.
  • Servers - this provides a list of all the servers in the emdash database Servers table.

Intellisense

In order to enable Intellisense for the context object when developing scripts in PowerShell ISE - run the following command once in your session:

[reflection.assembly]::LoadFrom("C:/emDash/workflow.service/emDash.Workflow.Step.Interface.dll")

Help

See the emdash CHM file emdash.Help.chm for a more detailed view of the interface.  The file is included in all emdash builds under the folder c:\emdash\help

Code samples are included in the folder c:\emdash\help\samples.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk