title: How to get the thread and the sampler name in JMeter
body: <p>I want to get the thread and the sampler names in JMeter Test Plan and keep it in the variables.</p>
  
  <p>I already keep the Test Plan name using the BeanShell Post Processor:</p>
  
  <blockquote>
    <p>import org.apache.jmeter.services.FileServer;</p>
    
    <p>String testPlanName = FileServer.getFileServer().getScriptName();
    vars.put("testPlanName", testPlanName)</p>
  </blockquote>
  
  <p>I use it in the Email notification to send the messages like "Test plan ${testPlanName} have received the response code ${responseCode}</p>
  
  <p>But I want to include the thread name and the sampler name the same way.</p>
  
  <p>I already tried to add the BeanShell Post Processor .getThreadname() and .getSampleName() and import import org.apache.jmeter.samplers.SampleResult; but it doesn't work.</p>
  
  <p>How can I get that names and use it like variables?</p>