'How to call a method outside ActiveChoice's DynamicReferenceParameter?

I'm using the ActiveChoice in my Jenkins Library. I've created a method that is returning parameters:

  def myInternalMethod() {
   return '''
           <input type="checkbox" class="setting-input" name="value" value="yes" style="width: 150px;">
          '''
  }


  def buildReleaseParameters() {

    def params = [];

    params.add(parent.booleanParam(name: BUILD_RELEASE, description: BUILD_RELEASE_DESC, defaultValue: false))
    params.add([
            $class: 'DynamicReferenceParameter', 
            choiceType: 'ET_FORMATTED_HTML', 
            description: BUILD_RELEASE_VERSIONING_DESC, 
            omitValueField: true,
            name: BUILD_RELEASE_VERSIONING, 
            referencedParameters: BUILD_RELEASE, 
            script: [
                $class: 'GroovyScript', 
                fallbackScript: [
                    classpath: [], 
                    sandbox: true, 
                    script: 
                        "return['Failed']"
                ], 
                script: [
                    classpath: [], 
                    sandbox: true, 
                    script: 
                      """
                        html= myInternalMethod()
                        
                        return html
                      """
                ]
            ]
        ])
    
    return params
}

I would like to retrieve the html that is currently inside script: from a method in the same class. Is there any way to do that ?



Sources

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

Source: Stack Overflow

Solution Source