Defining variables with the jobprop utility
You can use the jobprop utility in a task definition to set output properties that you can utilize in other tasks. The feature is useful when you need to use specific values or parameters across different tasks.
Overview
You can set these output properties when you create a task definition or update an existing task definition. Use this utility only on executable tasks to define custom output properties within the task definition. After the task is completed, you can make use of these properties to run another task. For instance, a variable could dictate the file path or parameters that can be used by another task.
To make the smooth functioning of jobprop utility
in Windows operating systems, the jobprop.exe file is extracted from
the plug-in when you run a task using HCL UnO agent. You can
set the path for the file when you configure the agent or you can update the
agent.properties file after configuration. You must specify a path
that is accessible for all the users. The default path is
C:\ProgramData\HCL\UnO\Agent_Name. You can only
modify the path before the folder UnO. If you want to set the path
while configuring, add the commonTempPath property parameter. If not, you can update
the agent.properties file to add the
uno.agent.common.temp.dir parameter.
Syntax and options
jobprop variable value
- variable
- The variable name and you can provide any type of variable to set as an output property. The name is case-sensitive and if it contains spaces, they must be included in single quotes.
- value
- The value for the variable. The value is case-sensitive and if it contains spaces, they must be included in single quotes.
Examples
- ANDROID_HOME variable set to C:\\Users\\john\\AppData\\Local\\Android\\Sdk value.
- JAVA_HOME variable set to C:\\Program Files\\Java\\jdk-17.0.1 value.
$job
/BRTD123#/TASKB
DESCRIPTION "Sample executable task definition"
TASK
{
"executable" : {
"interactive" : "false",
"script" : "call C:\\Progra~1\\HCL\\TWA\\TWS\\tws_env.cmd \n jobprop ANDROID_HOME C:\\Users\\john\\AppData\\Local\\Android\\Sdk \n jobprop JAVA_HOME C:\\Program Files\\Java\\jdk-17.0.1"
}
}
SUCCOUTPUTCOND RCCONDSUCC "RC>=0"
RECOVERY STOP
- ANDROID_HOME variable set to C:\\Users\\john\\AppData\\Local\\Android\\Sdk value.
- JAVA_HOME variable set to C:\\Program Files\\Java\\jdk-17.0.1 value.
$job
/TRT1#/TASK4
DESCRIPTION "Sample executable task definition"
TASK
{
"executable" : {
"interactive" : "false",
"script" : "#!/bin/sh \n jobprop ANDROID_HOME C:\\Users\\john\\AppData\\Local\\Android\\Sdk \n jobprop JAVA_HOME C:\\Program Files\\Java\\jdk-17.0.1"
}
}
SUCCOUTPUTCOND RCONDSUCC "RC>=0"
RECOVERY STOP
For more information about how variables are passed to another task, see Passing variables set by using jobprop in one task to another in the same workflow instance.