# Does $event-\>setResult(false) create a failure notification in the web interface?

**URL:** https://forum.mautic.org/t/does-event-setresult-false-create-a-failure-notification-in-the-web-interface/15020
**Category:** Development
**Created:** [June 30, 2020, 5:41pm UTC](https://forum.mautic.org/t/does-event-setresult-false-create-a-failure-notification-in-the-web-interface/15020 "2020-06-30T17:41:15Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![danielhilst](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/danielhilst/32/2132_2.png) [@danielhilst](https://forum.mautic.org/u/danielhilst)
#### Post date: [June 30, 2020, 5:41pm UTC](https://forum.mautic.org/t/does-event-setresult-false-create-a-failure-notification-in-the-web-interface/15020/1 "2020-06-30T17:41:16Z")

</div>

Hi everybody

I’m writing a custom plugin. This plugin create an action for calling user by phone using a SaaS, this action works by calling a REST service with the contact information. At the first call the user is added to a queue, and then I need to keep requesting status until the contact is finally contacted, and then I stop requesting that status.

Technically speaking, my action will execute `$event->setResult(false)` until the contact is contacted, then I call `$event->setResult(true)` or `$event->setFailed('some error')` depending on success or failure in contact.

My problem is that I got a lot of error notifications regarding these `$event->setResult(false)` calls, how can I avoid this notifications on the Mautic interface? Is this the expected behavior? Here is an screenshot:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/a/a255f8515f3bccf889bf98e3c272c33085bc4c1a.png)

Also, once I call `$event->setResult(true)` I expect to see the completed counter to increase but it’s still 0

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/c/c3c27927d69563d7d5916ac7f416d897f0586b16.png)

I run these commands by hand to test, every time I add a new contact while I’m developing.

```auto
app/console --env=dev mautic:segments:update
app/console --env=dev mautic:campaign:update
app/console --env=dev mautic:campaign:trigger

```

Can it be a missing command?

I’m running version 2.16.2-6-gc1759b7a from git.

– edit –

From what I could find I have these entries on `<prefix>lead_event_log` and `<prefix>lead_event_failed_log`

```auto
mysql> select c.firstname, a.id, a.event_id, a.lead_id, a.campaign_id, a.is_scheduled, b.date_added failed_date_added, a.date_triggered from mauticcampaign_lead_event_log a join mauticcampaign_lead_event_failed_log b on a.id = b.log_id join mauticleads c on c.id = a.lead_id;
+-----------+-----+----------+---------+-------------+--------------+---------------------+---------------------+
| firstname | id | event_id | lead_id | campaign_id | is_scheduled | failed_date_added | date_triggered |
+-----------+-----+----------+---------+-------------+--------------+---------------------+---------------------+
| Daniel | 223 | 45 | 5 | 43 | 0 | 2020-06-30 00:06:31 | 2020-06-30 00:09:11 |
| Daniel 2 | 224 | 45 | 6 | 43 | 0 | 2020-06-30 00:06:32 | 2020-06-30 00:09:11 |
| Daniel 3 | 225 | 45 | 8 | 43 | 0 | 2020-06-30 00:20:42 | 2020-06-30 00:22:10 |
| Daniel 4 | 226 | 45 | 9 | 43 | 0 | 2020-06-30 17:27:43 | 2020-06-30 17:27:50 |
+-----------+-----+----------+---------+-------------+--------------+---------------------+---------------------+

```

So I have some entries on `lead_event_failed_log`, maybe are these tied to the failed notifications in the web interface?

I couldn’t find out what controls the pending actions counter yet ☹

---

<div class="post-metadata">

### Author: ![danielhilst](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/danielhilst/32/2132_2.png) [@danielhilst](https://forum.mautic.org/u/danielhilst)
#### Post date: [July 2, 2020, 6:21pm UTC](https://forum.mautic.org/t/does-event-setresult-false-create-a-failure-notification-in-the-web-interface/15020/2 "2020-07-02T18:21:41Z")

</div>

Just to update, I track down the pending actions count to this query

```auto
SELECT
  o.event_id, count(o.lead_id) as lead_count, o.non_action_path_taken
FROM
  mautic_campaign_lead_event_log o
LEFT JOIN
  mautic_campaign_leads l ON l.campaign_id = 44 and
  l.manually_removed = 0 and
  o.lead_id = l.lead_id and
  l.rotation = o.rotation
WHERE
  (o.campaign_id = 44) AND
  (NOT EXISTS (
      SELECT null
      FROM mautic_campaign_lead_event_failed_log fe
      WHERE fe.log_id = o.id)
  ) GROUP BY o.event_id, o.non_action_path_taken

```

It seems that we need a _long running task_ concept, for tasks that will take more than one action run to complete, that do not failed, or succeeded, yet. That would help for such cases. Anyway I’m not 100% sure that I got the entire picture here, so a word of the devs would be valuable, does `$event->setResult(false)` create an entry in `campaign_lead_event_failed_log`? Is there a way to retry an action without creating such entry (if it does create)?

From what I could grasp from that query, it doesn’t consider as completed an action that has entries in the `campaign_lead_event_failed_log` is that right?
