How to access project environment variables from the stage script?

Question

How to access project environment variables from the stage script?

 

Answer

As an example, we will set up a string variable with the name "variable" in the project properties on the Environment Variables tab.

mceclip0.png

To access this variable from the script workflow stage, we need to cover two cases that depend on the script type:

  • document processing

In this script type, the C# example looks like this.

var env_var = Document.Batch.Project.EnvironmentVariables.Get("%variable_name%");

  • batch processing

For the batch processing, the C# example looks like this.

var env_var = Batch.Project.EnvironmentVariables.Get("%variable_name%").ToString();


The difference between these scripts is caused by the FlexiCapture objects that are available for us to interact with.

Additional information

Environment variables

IDocument

IBatch

IProject

 

 

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.