It looks like you might be mixing up some usages..if the variable is an environment variable (and that is the only type that will work in a template), you'd want to do something like this:
<td><% ENV(var:"MYTOOL_VERSION") %></td> This may only work with the most recent email-ext version. On Thu, Mar 28, 2019 at 7:39 AM kalkin powale <[email protected]> wrote: > Hi All, > > I wish to send some parameter/ variable from the current build job to the > Email template to send it in an email. > > I have saved my email template as Manage_Jenkins>> Managed_Files >> > custom_groovy_Email.groovy > > in email template, I am trying to use it as follows > <td>Duration:</td> > <td>${build.durationString}</td> > </tr> > <tr> > <td>Cause:</td> > <td><% build.causes.each() { cause -> %> ${cause.shortDescription} > <% } %></td> > </tr> > <tr> > <td>Tool version:</td> > //<td>${ENV(var="MYTOOL_VERSION")}</td> > //<td>${ENV(var:"MYTOOL_VERSION")}</td> > <td>${build.buildVariables.MYTOOL_VERSION}</td> > </tr> > </table> > <br/> > > And In the groovy file in job configuration, I have tried setting it like > this > > import hudson.EnvVars > import hudson.model.Environment > import hudson.model.* > > node{ > stage(tool){ > //def MYTOOL_VERSION = '1.33' > //evn.MYTOOL_VERSION = '1.33' > def MYTOOL_VERSION = build.getEnvVars()["${MYTOOL_VERSION}"] > > } > } > > But it does not seem to be working. > > Can anybody help me in this regards, Thank you. > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-users/dba3d9d3-2bfb-4343-96db-4b68156b9391%40googlegroups.com > <https://groups.google.com/d/msgid/jenkinsci-users/dba3d9d3-2bfb-4343-96db-4b68156b9391%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Website: http://earl-of-code.com -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfy61hwSmVLA5eDbvdhO7oDfrUm3bZwy4VVdVfJYiuh2A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
