Answers.Body: <pre><code>craft()-&gt;on('amForms_submissions.saveSubmission', function(Event $event) {
      BusinessLogicPlugin::log(print_r($event, true));
  });
  </code></pre>
  
  <p>Pay attention to the casing<br>
  <code>Craft\AmForms_SubmissionsService</code> → <code>amForms_submissions</code></p>
  
  <p><a href="https://craftcms.com/docs/plugins/hooks-and-events#listening-for-events" rel="nofollow">https://craftcms.com/docs/plugins/hooks-and-events#listening-for-events</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-28T15:19:26.753Z
Answers.Text: I've updated my question, i was wrong with what i was doing in the first instance.
Answers.UserDisplayName: John
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-28T15:21:01.750Z
Answers.Text: `saveSubmission` not `onSaveSubmission`, see the linked docs article.
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-28T15:42:53.263Z
Answers.Text: Right, gotcha! However, i've updated my code to amForms.saveSubmission and i'm still getting ```Internal Server Error
  
  Property "Craft\AmFormsService.onSaveSubmission" is not defined.```
Answers.UserDisplayName: John
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-28T15:50:16.603Z
Answers.Text: Just had a quick look at the plugins source code and updated the answer to what I think should work.
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-28T15:55:47.810Z
Answers.Text: I'm not getting an error now, but also no data is being dumped. Not sure this is working either.
Answers.UserDisplayName: John
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-28T16:02:31.243Z
Answers.Text: Try `MyPluginPlugin::log($event)` instead of dumping.
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-28T16:16:40.027Z
Answers.Text: It's adding nothing to the log i'm afraid (and i do have devmode set to true!)
Answers.UserDisplayName: John
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-28T15:18:12.140Z
Answers.LastActivityDate: 2016-03-28T17:08:13.390Z
Answers.LastEditDate: 2016-03-28T17:08:13.390Z
Answers.UserDisplayName: carlcs
Body: <p>Trying to work out if I’m doing something wrong with catching an event from another plugin in my plugin.</p>
  
  <p>I’m trying to use <a href="https://github.com/am-impact/amforms" rel="nofollow">amforms</a> “onSaveSubmission” event, so, in my plugin’s <code>init()</code> 
  function i have</p>
  
  <pre><code>craft()-&gt;on('amForms.onSaveSubmission', function(Event $event) {
      var_dump($event);
  });
  </code></pre>
  
  <p>But, when I submit a form successfully, this event is triggering an error:</p>
  
  <pre><code>Internal Server Error
  
  Property "Craft\AmFormsService.onSaveSubmission" is not defined.
  </code></pre>
  
  <p>The <code>onSaveSubmission</code> event is in <code>/plugins/amforms/services/AmForms_SubmissionsService.php</code></p>
  
Tags: <events>
Title: Calling an event from a third party plugin in my plugin
ThreadText: # Calling an event from a third party plugin in my plugin
  
  (Asked by: username_0 on 2016-03-28)
  
  Trying to work out if I’m doing something wrong with catching an event from another plugin in my plugin.
  
  I’m trying to use [amforms](https://github.com/am-impact/amforms) “onSaveSubmission” event, so, in my plugin’s `init()`
  function i have
  
  ```
  craft()->on('amForms.onSaveSubmission', function(Event $event) {
      var_dump($event);
  });
  
  ```
  
  But, when I submit a form successfully, this event is triggering an error:
  
  ```
  Internal Server Error
  
  Property "Craft\AmFormsService.onSaveSubmission" is not defined.
  
  ```
  
  The `onSaveSubmission` event is in `/plugins/amforms/services/AmForms_SubmissionsService.php`
  
  **Tags:** events
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-03-28. Score: 4 | Accepted answer
  
  ```
  craft()->on('amForms_submissions.saveSubmission', function(Event $event) {
      BusinessLogicPlugin::log(print_r($event, true));
  });
  
  ```
  
  Pay attention to the casing  
  `Craft\AmForms_SubmissionsService` → `amForms_submissions`
  
  <https://craftcms.com/docs/plugins/hooks-and-events#listening-for-events>
  
  > **Comments:**
  > **username_0**: I've updated my question, i was wrong with what i was doing in the first instance.  
  > **username_1**: `saveSubmission` not `onSaveSubmission`, see the linked docs article.  
  > **username_0**: Right, gotcha! However, i've updated my code to amForms.saveSubmission and i'm still getting ```Internal Server Error  Property "Craft\AmFormsService.onSaveSubmission" is not defined.```  
  > **username_1**: Just had a quick look at the plugins source code and updated the answer to what I think should work.  
  > **username_0**: I'm not getting an error now, but also no data is being dumped. Not sure this is working either.  
  > **username_1**: Try `MyPluginPlugin::log($event)` instead of dumping.  
  > **username_0**: It's adding nothing to the log i'm afraid (and i do have devmode set to true!)  
  
  ---
  
  