Use the SetEnvironmentVariable component
Create or update an environment variable as part of an automation Workflow by using the SetEnvironmentVariable component in RPA Desktop Design Studio. These variables persist across activities and can be retrieved later using GetEnvironmentVariable.
Avant de commencer
Role required: none
Pourquoi et quand exécuter cette tâche
You can configure the properties for the SetEnvironmentVariable component. For more information about these properties, see Properties of the Environment components.
Procédure
GetEnvironmentVariable component
You want your robot to process files and save logs to different folders depending on whether it's running in Development or Production mode.
- At the start of the automation, use SetEnvironmentVariable to define the following variables:
ENV_MODE = DevelopmentLOG_PATH = C:\RPA\Dev\Logs
This variable defines if robot is running in the development mode, where to store the log files.
- Later in the workflow, when saving log files, use GetEnvironmentVariable to retrieve the value of
LOG_PATH.The robot dynamically stores the log files as per the value in the
LOG_PATHvariable. - In production, simply update the environment variable setup to:
ENV_MODE = ProductionLOG_PATH = C:\RPA\Prod\Logs
The robot now logs to the production folder automatically, because it reads the
LOG_PATHvalue from the environment variable.