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:
- Procedure Top
- Procedure Middle
In Procedure Bottom command step, what are the results of the following steps?
``` echo $[/myJob/ParamB] ``` Result: PROPERTY_REFERENCE_ERROR ***There is no ParamB on the Procedure Top job.***
``` echo $[/myParent/myParent/procedureName] ``` Result: PROPERTY_REFERENCE_ERROR ***The command step does not have a chain of parentage. Only the parent does.***
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.