Mautic Community Forums

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

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:

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

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

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

mysql> select c.firstname,, 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 = b.log_id join mauticleads c on = 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 :frowning:

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

  o.event_id, count(o.lead_id) as lead_count, o.non_action_path_taken
  mautic_campaign_lead_event_log o
  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
  (o.campaign_id = 44) AND
      SELECT null
      FROM mautic_campaign_lead_event_failed_log fe
      WHERE fe.log_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?