title: IBM Watson Assistant / Conversation : The output displays the last search
body: <p>I have developed cloud functions and am using 'generic output' with image response types, as well as text. However when I search for a product (which uses my cloud function), the last result appears.</p>
  
  <p>For example: </p>
  
  <blockquote>
    <p>Me: Buy Classic now</p>
    
    <p>Bot: Name: Classic, Price: 4.99, Description: Classic description</p>
  </blockquote>
  
  <p>But when I search for another product</p>
  
  <blockquote>
    <p>Me: Buy Extra now</p>
  </blockquote>
  
  <p>the bot will display</p>
  
  <blockquote>
    <p>Bot: Name: Classic, Price: 4.99, Description: Classic description</p>
  </blockquote>
  
  <p>Only until another search instance does it refresh and display the correct result.</p>
  
  <pre><code>{
    "context": {
      "name": "",
      "counter": 0
    },
    "output": {
      "generic": [
        {
          "values": [
            {
              "text": "Found  Products"
            }
          ],
          "response_type": "text",
          "selection_policy": "sequential"
        },
        {
          "title": "&lt;? $result.body.items[0].name ?&gt;",
          "source": "http://**********/pub/media/catalog/product&lt;? $result.body.items[0].custom_attributes[5].value ?&gt;",
          "description": "$&lt;? $result.body.items[0].price ?&gt;",
          "response_type": "image"
        },
        {
          "title": "Select one of the following options",
          "options": [
            {
              "label": "Order a subscription",
              "value": {
                "input": {
                  "text": "Order a subscription"
                }
              }
            },
            {
              "label": "More Details",
              "value": {
                "input": {
                  "text": "More Details"
                }
              }
            }
          ],
          "response_type": "option"
        }
      ]
    },
    "actions": [
      {
        "name": "/**********@gmail.com_dev/getProducts2",
        "type": "server",
        "parameters": {
          "url": "&lt;?entities.products[0].literal?&gt;"
        },
        "credentials": "$my_creds",
        "result_variable": "context.result"
      }
    ]
  }
  </code></pre>