KBEC-00088 - Changing procedure parameter values on the fly

Article ID:360032831752
1 minute readKnowledge base


Parameters have default values. This article discusses how to change the parameter’s default value when based on a previous entry or some other circumstance.

Solution 1: Use modifyFormalParameter

  1. Initially, set the default to the actual numeric value, like 123.

  2. Add a step to the procedure that calls the "modifyFormalParameter" API with the "defaultValue" optional parameter.

  3. Set the default value to the value that is used in this job, so if user A sets it to 124, that becomes the new default for user B.

Solution 2: Use a dynamic Custom Parameter List with a property sheet

First create a property sheet, for example NewGen_CSM_Options

  1. Create a nested property called 'optionCount'.

  2. The value equals the number of options in the dynamic list (example: 6).

  3. Create a nested property sheet for each option in the list, using 'option#' nomenclature (example: option1).

    1. Create a nested property called text within each option[#] sheet; the value equals the text that appears in the list.

    2. Create a nested property called value within each option[#] sheet; the value equals the value that will be passed to CloudBees CD (CloudBees Flow) when the option is selected.

Add the menu as a parameter:

  1. Choose Type: Dropdown menu.

  2. Select load options from the list.
    Example propertysheet reference: $[/projects/.ARCHIVES/NewGen_CSM_Options]

Changing the value in the property sheet will now result in the changed value appearing in the dynamic Custom Parameter List.