title: “Cannot call DocumentApp.getUi() from this context.”
body: <p>I can't run the code and I don't get what's wrong with it.</p>
  
  <pre><code>function onOpen(a) {
      var ui = DocumentApp.getUi() // ..
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/CbWeY.jpg" alt="How it looks like"></p>
  
  <p>Error:</p>
  
  <blockquote>
    <p>Cannot call DocumentApp.getUi() from this context. (line 2, file "Code")</p>
  </blockquote>