Custom parameter layouts

2 minute readAutomation

By default, parameters for procedures are displayed in alphabetical order based on the parameter name. Using the ec_parameterForm property allows parameters to be displayed in a specified order, different from the default, alphabetized order by name. This tutorial shows how to create a custom parameter layout for procedures.

To view an example procedure for this tutorial , go to the automation platform UI > Projects > EC-Tutorials- <version> , and click the procedure name.

An explanation of what you see:

  • This procedure implements two parameters.

  • The Action column contains the command to execute. In this case, the action shows the ec_parameterForm property which was attached to the procedure.

  • Notice the check marks in the Req? column, which indicates both parameters are "required" each time this procedure runs.

  • In the Custom Procedure Properties table, notice the " formElement " values supplied to determine the new parameter order.

  • If the procedure is run without the ec_parameterForm property, the parameter input form displays parameters alphabetical order.

Click Run.

On the Run Procedure page, notice you are presented with a Parameter section that shows the parameters in reverse order because values supplied for the ec_parameterForm property were called to create this new order.

The following XML creates the new order for these parameters:

<editor> <formElement> <property>second parameter</property> <label>this is the label for "second parameter"</label> <type>entry</type> <required>1</required> </formElement> <formElement> <property>first parameter</property> <label>this is the label for first parameter</label> <type>entry</type> <required>1</required> </formElement> </editor>

Click Run to run this sample procedure and see the resulting job status on the Job Details page.

Implementation

This tutorial is intended for viewing, but not modifications within its procedure, and any changes you might make will not be saved when you upgrade CloudBees CD/RO. However, in your own projects, you can use the sample XML above to change the parameter order in any of your procedures.

If you copy and paste the code samples we provided, using the ec_parameterForm property in one or more of your procedures, make sure you replace our example values with your parameter names, labels, and so on. If you have more than two parameters to reorder, create any number of additional <formElement> sections you need.