I have a JMeter test with 2 Thread Groups - the first is a single thread (which creates some inventory) and the second has multiple threads (which purchase all the inventory
I found which I believe is the most simple way to get this done.
Use
Bean Shell PostProcessor
Set in one Thread Group
to set the variable (http://jmeter.apache.org/usermanual/best-practices.html#bsh_variables)
import org.apache.jmeter.util.JMeterUtils;
JMeterUtils.setProperty("PC_CREATED_PROMO_CODE", "value");
OR if you want to set it to a value contained in another variable
import org.apache.jmeter.util.JMeterUtils;
JMeterUtils.setProperty("PC_CREATED_PROMO_CODE", vars.get("Extracted_PC_CREATED_PROMO_CODE"));
Get in the other Thread Group
And then from the other thread group, read it via (http://jmeter.apache.org/usermanual/functions.html#__property)
${__property(PC_CREATED_PROMO_CODE)}