title: How to pass the values from one scenario to another scenario in gatling?
body: <p>I have some end to end flow where I have to run a service and pass values to the next scenario. I can print the values inside the scenarios but not able to use them to next scenarios.</p>
  <p>I tried to save the values using SaveAs</p>
  <pre><code>val scn_Token1 ={ scenario(&quot;Token1&quot;)
      .exec(actionBuilder = http(&quot;Token1&quot;)
        .post(&quot;/getToken&quot;)
        .body(StringBody(bdy_Token)).asJson
        .check(status.is(200))
        .check(jsonPath(&quot;$.Token&quot;).exists)
        .check(jsonPath(&quot;$..Token&quot;)
          .find
          .saveAs(&quot;Token&quot;)
        )
        .check(jsonPath(&quot;$..id&quot;)
          .find
          .saveAs(&quot;mid&quot;)
        )
        .check(jsonPath(&quot;$..otp&quot;)
          .find
          .saveAs(&quot;otp&quot;)
        )
      )pause(tnk_token milliseconds)
    }
  
  
    val scn_Auth ={ scenario(&quot;Authentication&quot;)
      .exec(actionBuilder = http(&quot;Authentication&quot;)
        .post(authServiceUrl)
        .header(&quot;Token&quot;, &quot;${Token}&quot;)
        .header(&quot;id&quot;, &quot;${id}&quot;)
        .header(&quot;otp&quot;, &quot;${otp}&quot;)
        .body(StringBody(bdy_Auth)).asJson
        .check(status.is(200)))
        .pause(tnk_Auth milliseconds)
    }
  
  
  
    setUp(
     scn_Token1.inject(nothingFor(dly_token_first seconds),rampUsers(ucnt_token_first) during (ramp_token_first seconds)).protocols(httpConfToken),
    scn_Auth.inject(nothingFor(dly_Auth seconds),rampUsers(ucnt_Auth) during (ramp_Auth seconds)).protocols(httpConf)
    ).maxDuration(test_duration minutes)
  </code></pre>
  <p>I am getting error like</p>
  <blockquote>
  <p>'httpRequest-2' failed to execute: No attribute named 'id' is defined</p>
  <p>'httpRequest-2' failed to execute: No attribute named 'Token' is defined</p>
  </blockquote>
  <p>I also tried having wait time for second scenario in a way it will execute after scenario 1 completes. But still it doesn't get the values.</p>
  <p>Please note that I don't want the to merge token and Auth in single scenario as it has different configuration. values should be passed from one scenario to another. Please let me know what is going wrong here?</p>