Answers.Body: <p>Adding an event handler is not something you do through the control panel.</p>
  
  <p>What you need to do is create a <a href="https://craftcms.com/docs/plugins/introduction" rel="nofollow">plugin</a> (<a href="https://pluginfactory.io/" rel="nofollow">pluginfactory.io</a> makes this fairly easy), and in your plugin's main class, you have an <code>init()</code> function that looks like this:</p>
  
  <pre><code>public function init()
  {
      craft()-&gt;on('sproutForms.onSaveEntry', function (Event $event) {
          $entry = $event-&gt;params['entry']; // fetch the new entry
          ... do things with $entry ...
      });
  }
  </code></pre>
  
  <p>If you structure your plugin properly, you will "do things with <code>$entry</code>" by calling a <a href="https://craftcms.com/docs/plugins/services" rel="nofollow">Service</a>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-11T21:19:24.393Z
Answers.LastActivityDate: 2016-07-11T21:19:24.393Z
Answers.UserDisplayName: Marion Newlevant
Body: <p>I need to add an event handler for the <code>onSaveEntry</code> event in order to integrate with another system. In the admin screens for the form where and how do I add this event handler?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-07-11T14:01:29.320Z
Comments.Text: Can you confirm what type of action you need to perform on the `onSaveEntry` Event? In the case you are trying to trigger a notification email, Sprout Forms integrates with Sprout Email allowing notifications to be sent on the `sproutForms.onSaveEntry` Event.
Comments.UserDisplayName: Ben Parizek
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-07-11T19:01:13.643Z
Comments.Text: I need to integrate it with another system, so was planing to use an API to update the external system once a form has been saved.
Comments.UserDisplayName: Gurney
Tags: <events><plugin-sproutforms>
Title: Sprout Forms `onSaveEntry` event
ThreadText: # Sprout Forms `onSaveEntry` event
  
  (Asked by: username_0 on 2016-07-11)
  
  I need to add an event handler for the `onSaveEntry` event in order to integrate with another system. In the admin screens for the form where and how do I add this event handler?
  
  **Tags:** events, plugin-sproutforms
  
  > **Comments:**
  > **username_1**: Can you confirm what type of action you need to perform on the `onSaveEntry` Event? In the case you are trying to trigger a notification email, Sprout Forms integrates with Sprout Email allowing notifications to be sent on the `sproutForms.onSaveEntry` Event.  
  > **username_0**: I need to integrate it with another system, so was planing to use an API to update the external system once a form has been saved.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2016-07-11. Score: 4
  
  Adding an event handler is not something you do through the control panel.
  
  What you need to do is create a [plugin](https://craftcms.com/docs/plugins/introduction) ([pluginfactory.io](https://pluginfactory.io/) makes this fairly easy), and in your plugin's main class, you have an `init()` function that looks like this:
  
  ```
  public function init()
  {
      craft()->on('sproutForms.onSaveEntry', function (Event $event) {
          $entry = $event->params['entry']; // fetch the new entry
          ... do things with $entry ...
      });
  }
  
  ```
  
  If you structure your plugin properly, you will "do things with `$entry`" by calling a [Service](https://craftcms.com/docs/plugins/services).
  
  
  ---
  
  