title: EnvInject Error using Jenkins evaluated Groovy script
body: <p>We have a evaluated Groovy script in Jenkins below:-
  ;</p>
  
  <p>But the build is failing with error [EnvInject] - [ERROR] - [EnvInject] - [ERROR] - Problems occurs on injecting env vars as a build wrap: null
  17:04:06 Finished: FAILURE.
  Also how can I call the variable from Jenkins shell script to get last successful build date. -Thanks</p>
  
  <pre><code>def env = System.getenv()
  def item = Jenkins.instance.getItem("")
   def  f=item.getLastFailedBuild()
  
   println f.getTime()
  
   def  ff=env['item.getLastSuccessfulBuild()]
    println ff.getTime().format("YYYY-MMM-dd HH:MM:SS")
    println ff.getTime().format("dd-MM-yyyy")
  
    def pa = new ParametersAction([new          StringParameterValue('PARAMETER_NAME', ff)]);
  </code></pre>
  
  <p>Thread.currentThread().executable.addAction(pa) 
  println 'Script finished! \n<code>env variable</code></p>