KBEC-00270 - Referencing Parameters in Sub-Procedures

Article ID:360033191411
1 minute readKnowledge base
On this page


When you have a parameter from the parent procedure, how can you reference it from a sub-procedure?


Use the /myParent reference to allow a sub-procedure to access the values of properties in the parent (calling) procedure.

When you supply input to a procedure (or sub-procedure), this information is stored in the job Parameter Sheet.

The following diagram shows three procedures that pass parameters to each other. In the procedure called Procedure Bottom, the output of the command step is various properties from the job and parent procedure (Procedure Middle).

The following is the output from the command steps in Procedure Bottom:

  • foo

  • foo_foo

  • bar

  • Procedure Top

  • Procedure Middle

In Procedure Bottom command step, what are the results of the following steps?


echo $[/myJob/ParamB]

***There is no ParamB on the Procedure Top job.*** *

echo $[/myParent/myParent/procedureName]

***The command step does not have a chain of parentage. Only the parent does.*** * Use `/javacript getProperty` instead:

$[/javascript getProperty(getProperty(myJobStep ,"/myParent") ,"/myParent").procedureName;

Result: Procedure Top

We recommend that you create the previous procedures and test the various parameter commands to better understand the using the /myParent calls.

This information is from the CloudBees CD (CloudBees Flow) Advanced Training presentation.