title: Gatling Need to run next scenario if previous scenario is passed using doIf
body: <p>i am new to Scala and gatling. i need to run scenaio if previous scenario is passed using doIf.</p>
  
  <p>My code is:</p>
  
  <p>HttpRequest</p>
  
  <pre><code>object CompanyProfileRequest {
  
  val check_company_profile: HttpRequestBuilder = http("Create Company 
   Profile")
  .get(onboarding_url_perf + "/profile")
  .headers(basic_headers)
  .headers(auth_headers)
  .check(status.is(404).saveAs("NOT_FOUND"))
  
  
  val create_company_profile: HttpRequestBuilder = http("Create Company 
   Profile")
  .post(onboarding_url_perf + "/profile")
  .headers(basic_headers)
  .headers(auth_headers)
  .body(RawFileBody("data/company/company_profile_corporation.json")).asJson
  .check(status.is(200))
  .check(jsonPath("$.id").saveAs("id"))
   }
  </code></pre>
  
  <p>Scenario class is:-</p>
  
  <pre><code> object ProfileScenarios {
  
    val createProfileScenarios: ScenarioBuilder = scenario("Create profile 
    Scenario")
    .exec(TokenScenario.getCompanyUsersGwtToken)
    .exec(CompanyProfileRequest.check_company_profile)
    .doIf(session =&gt; session.attributes.contains("NOT_FOUND")) {
     exec(CompanyProfileRequest.create_company_profile).exitHereIfFailed
     }
   }
  </code></pre>
  
  <p>And Simulation is :-</p>
  
  <pre><code>      private val createProfile = ProfileScenarios
       .createProfileScenarios
       .inject(constantUsersPerSec(1) during (Integer.getInteger("ramp", 1) 
       second))
  
       setUp(createProfile.protocols(httpConf))
  </code></pre>
  
  <p>Whenever i am running this simulation, I am not able to check this condition:-</p>
  
  <p>.doIf(session => session.attributes.contains("NOT_FOUND"))</p>
  
  <p>Any help is much appreciated.</p>
  
  <p>Regards,
  Vikram</p>