'Active Choices Reactive Reference Parameter is not referring Boolean parameter in Jenkins

I'm using Jenkins for the release processes. In a freestyle project, I need to show 'To Mail Id' input box to get mail ids to send mail only when 'Send Mail' check box should be checked. For the requirement, I am using 'Formatted HTML' in 'Active Choices Reactive Reference Parameter' to display 'To Mail Id' input box and 'Boolean Parameter' to display the 'Send Mail' check box. And I am referring 'Send Mail' boolean parameter name in 'Referenced parameters' of 'To Mail Id'-'Active Choices Reactive Reference Parameter'. Using groovy script, based on the boolean parameter, the mail id input text is displayed.

The issue is that the 'Boolean Parameter' check and uncheck switching is not reflecting in 'Active Choices Reactive Reference Parameter'. How to resolve the same?

Groovy Script used in 'Active Choices Reactive Reference Parameter'

def sendMail = SEND_MAIL;
if (sendMail.equals('on')){
html_to_be_rendered = """<table><tr>
                                    <td>
                                      <label>TO_MAIL_ID</label>
                                    </td>
                                    <td>
                                      <input type="text" class="setting-input" name="value" size="70" id="to_mail_id">
                                      <small>Enter To Mail ID.This is a comma separated list (optional white space after commas) of mail IDs that should receive mails. E.g., [email protected], [email protected].</small>
                                    </td>
                                    </tr> 
                                </table>"""
    return html_to_be_rendered
} else {
html_to_be_rendered =""
    return html_to_be_rendered
}

Screenshot #1 - Send Mail Boolean Parameter

enter image description here

Screenshot #2 - To Mail Id Active Choices Reactive Reference Parameter

enter image description here



Solution 1:[1]

Please use Active Choices Parameter Instead of Boolean Value.

Although there is no clear plugin documentation for the supported reference parameter in "Active Choices Reactive Reference Parameter", perhaps it supports only Active Choice parameter as reference parameter.

Solution 2:[2]

What version of Jenkins are you using? I ran into a same issue via use Active Choices Reactive Parameter on 2.343, but on 2.332 it's a valid case

WA: use Choice Parameter - return ['off', 'on'] or Active Choices Parameter - return ['on'] (via use choice type - check boxes)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Himanshu Gupta
Solution 2 mothen