
Hi!
The syntax for using options/data values in inline scripts is @option.name@/@data.name@/@export.name@. Anyway, I made an example showing how to elevate this as a global variable in Powershell and pass that global variable to another job using job reference.
The main job generates an example data value and converts it to a global variable in Powershell (also, it calls a Child job, passing that value as an argument). Check the script step, powershell.exe is defined as “invocation string” and .ps1 as extension.
- defaultTab: nodes description: '' executionEnabled: true id: e29d0a11-d58e-4753-b9c9-06d001d3c188 loglevel: INFO name: GlobalVariablePowerShell nodeFilterEditable: false nodefilters: dispatch: excludePrecedence: true keepgoing: false rankOrder: ascending successOnEmptyNodeFilter: false threadcount: '1' filter: 'name: windows ' nodesSelectedByDefault: true plugins: ExecutionLifecycle: {} scheduleEnabled: true sequence: commands: - exec: echo "customer=john" plugins: LogFilter: - config: invalidKeyPattern: \s|\$|\{|\}|\\ logData: 'true' regex: ^(.*)=(.*)$ replaceFilteredResult: 'false' type: key-value-data - configuration: export: CUSTOMERNAME group: export value: ${data.customer*} nodeStep: false type: export-var - fileExtension: .ps1 interpreterArgsQuoted: false script: echo @export.CUSTOMERNAME@ scriptInterpreter: powershell.exe - jobref: args: -opt1 ${export.CUSTOMERNAME} group: '' name: Child nodeStep: 'true' uuid: d2f4c7a4-f374-4eaf-8c55-49f316fea42d keepgoing: false strategy: node-first uuid: e29d0a11-d58e-4753-b9c9-06d001d3c188The Child Job (it contains an option to “receive” the global variable content from the parent job via Job Reference Step):
- defaultTab: nodes description: '' executionEnabled: true id: d2f4c7a4-f374-4eaf-8c55-49f316fea42d loglevel: INFO name: Child nodeFilterEditable: false options: - name: opt1 plugins: ExecutionLifecycle: {} scheduleEnabled: true sequence: commands: - exec: echo ${option.opt1} keepgoing: false strategy: node-first uuid: d2f4c7a4-f374-4eaf-8c55-49f316fea42dOf course, you can pass the data variable directly to the child job instead of elevating it as a global variable.
Check the result. More info here.
Regards!