<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>

CC BY-SA 3.0
2016-03-28T15:19:26.753Z
I've updated my question, i was wrong with what i was doing in the first instance.
John
CC BY-SA 3.0
2016-03-28T15:21:01.750Z
`saveSubmission` not `onSaveSubmission`, see the linked docs article.
carlcs
CC BY-SA 3.0
2016-03-28T15:42:53.263Z
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.```
John
CC BY-SA 3.0
2016-03-28T15:50:16.603Z
Just had a quick look at the plugins source code and updated the answer to what I think should work.
carlcs
CC BY-SA 3.0
2016-03-28T15:55:47.810Z
I'm not getting an error now, but also no data is being dumped. Not sure this is working either.
John
CC BY-SA 3.0
2016-03-28T16:02:31.243Z
Try `MyPluginPlugin::log($event)` instead of dumping.
carlcs
CC BY-SA 3.0
2016-03-28T16:16:40.027Z
It's adding nothing to the log i'm afraid (and i do have devmode set to true!)
John
CC BY-SA 3.0
2016-03-28T15:18:12.140Z
2016-03-28T17:08:13.390Z
2016-03-28T17:08:13.390Z
carlcs
<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>

<events>
Calling an event from a third party plugin in my plugin
# 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 “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!)  

---

