Your software
My Mautic version is: 4.4.6
My PHP version is: 7.4.33
My Database type and version is: Percona 8.0.33-25
Your problem
My problem is:
I have one campaign where I can only add users but not remove them. Not in the front end and not via API.
These errors are showing in the log:
[2023-09-04 10:42:23] mautic.ERROR: CAMPAIGN: An exception occurred while executing ‘REPLACE INTO campaign_lead_event_failed_log( log_id, date_added, reason) SELECT id, :dateAdded as date_added, :message as reason from campaign_lead_event_log WHERE is_scheduled = 1 AND lead_id = :contactId AND campaign_id = :campaignId AND rotation = :rotation’: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':dateAdded as date_added, :message as reason from campaign_lead_event_log WHERE ’ at line 2 {“hostname”:“0e0b8ad87d42”,“pid”:918415}
Showing this error about once a minute.
Steps I have tried to fix the problem:
Cleared the cache
I suppose the method differs if you want to remove a few or a lot of contacts.
If it concerns a few contacts, I would try creating a [tag] or a segment B for those contacts. Add this tag or segment B to those specific contacts in each contact page.
Then, if you exclude this tag/segment B in your filter’s segment A, it should work.
If you have to remove a lot of contact, it is better to have a common factor to apply a filter in the segment. One example I have, but I don’t know if it could actually help you : create a campaign based on one condition, let’s say they have reached 50 points or clicked a specific link, then you can add a tag or include those contacts in a new segment B. Filter the segment A excluding tag or excluding segment B.
My problem was a different one, that something in the config or the database was not allowing any kind of removal from a campaign, no matter what method used. I did a fresh installation and migrated the data and now it works.