Answers.Body: <p>To show a message </p>
  
  <pre><code>Craft::$app-&gt;getSession()-&gt;setNotice($message);
  </code></pre>
  
  <p>To show an error</p>
  
  <pre><code>Craft::$app-&gt;session-&gt;setError($message);
  </code></pre>
  
  <p>There is no "default" key that is always shown or something like that. You just use the function and set a message -> the next time the user visits <em>any</em> page the message is shown.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-04T20:54:10.683Z
Answers.Text: Hi Robin - that doesn't seem to work for me. I set the flash message then redirect away with '\Craft::$app->controller->redirect("/admin/entries/tvListings");' and I get no flash message.
Answers.UserDisplayName: JamesNZ
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-04T20:59:29.140Z
Answers.Text: I'm really sorry... I messed up the functions. Please see my update
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-04T23:20:18.440Z
Answers.Text: You're a gentleman and a scholar. That worked perfectly. Thanks Robin.
Answers.UserDisplayName: JamesNZ
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-03T06:12:15.563Z
Answers.LastActivityDate: 2018-04-04T20:59:10.040Z
Answers.LastEditDate: 2018-04-04T20:59:10.040Z
Answers.UserDisplayName: Robin Schambach
Body: <p>I've written a plugin that imports a CSV and creates entries from that for a client. I'm wanting to redirect them to the entries listing page after (i.e. /admin/entries/tvListings) and show a flash message saying "X TV listings imported.".</p>
  
  <p>So this is a 2 parter:</p>
  
  <ol>
  <li>How do you set flash data in Craft 3.</li>
  <li>Is there a default flash key that'll show as soon as I land on the entries listing page?</li>
  </ol>
  
  <p>Thanks.</p>
  
Tags: <craft3>
Title: Showing A Flash Message On Admin Entries Listing (Craft 3)
ThreadText: # Showing A Flash Message On Admin Entries Listing (Craft 3)
  
  (Asked by: username_0 on 2018-04-03)
  
  I've written a plugin that imports a CSV and creates entries from that for a client. I'm wanting to redirect them to the entries listing page after (i.e. /admin/entries/tvListings) and show a flash message saying "X TV listings imported.".
  
  So this is a 2 parter:
  
  1. How do you set flash data in Craft 3.
  2. Is there a default flash key that'll show as soon as I land on the entries listing page?
  
  Thanks.
  
  **Tags:** craft3
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-04-03. Score: 6 | Accepted answer
  
  To show a message
  
  ```
  Craft::$app->getSession()->setNotice($message);
  
  ```
  
  To show an error
  
  ```
  Craft::$app->session->setError($message);
  
  ```
  
  There is no "default" key that is always shown or something like that. You just use the function and set a message -> the next time the user visits *any* page the message is shown.
  
  > **Comments:**
  > **username_0**: Hi username_1 - that doesn't seem to work for me. I set the flash message then redirect away with '\Craft::$app->controller->redirect("/admin/entries/tvListings");' and I get no flash message.  
  > **username_1**: I'm really sorry... I messed up the functions. Please see my update  
  > **username_0**: You're a gentleman and a scholar. That worked perfectly. Thanks username_1.  
  
  ---
  
  