title: How to Write Global Functions in Postman
body: <p>I need help writing a common function to use across a collection of requests which will help with building a framework.</p>
  
  <p>I have tried using the below format </p>
  
  <p>The following function is declared in the Test tab in the first function</p>
  
  <pre><code>postman.setGlobalVariable("function", function function1(parameters)
  {
    //sample code
  });
  </code></pre>
  
  <p>I used the following in the pre-request</p>
  
  <pre><code>var delay = eval(globals.function);
  delay.function1(value1);
  </code></pre>
  
  <p>I am getting the following error </p>
  
  <p><strong>there was error while evaluating the Pre-request script : Cannot read property 'function1'  of undefined.</strong></p>
  
  <p>Can anyone help me with how to define Global/common functions and use them across the requests?</p>
  
  <p>Thanks in advance</p>