Campaign: Condition based on a contact field value issue

Hey all,



I would like to create campaign with condition based on a contact field value.



This is my plan:

  1. Add custom contact field: campaign-start (type date/time)
  2. Create pre-campaign. In the campaign, I add condition: “condition based on a contact field value”.
  3. I choose contact field: campaign-start , operator: date, value: is today (when save change to +P0D)
  4. Action: change campaign to campaign-followup
  5. Base on my understanding: once the campaign-start equal with today, the campaign will change from pre-campaign to campaign-followup
  6. Unfortunately, it does not work.



    Did I made something wrong? Anyone made similar with this before and did worked?



    Thanks a bunch.

Hey olafdammann,

Thank you for your reply.

My crontab:

*/5 * * * * /usr/bin/php -q /var/www/mydomain/htdocs/app/console mautic:segments:update >/dev/null 2>&1
*/5 * * * * /usr/bin/php -q /var/www/mydomain/htdocs/app/console mautic:campaigns:rebuild >/dev/null 2>&1

          • /usr/bin/php -q /var/www/mydomain/htdocs/app/console mautic:campaigns:trigger >/dev/null 2>&1
          • /usr/bin/php -q /var/www/mydomain/htdocs/app/console mautic:broadcasts:send >/dev/null 2>&1

*/15 * * * * /usr/bin/php -q /var/www/mydomain/htdocs/app/console mautic:webhooks:process >/dev/null 2>&1
*/15 * * * * /usr/bin/php -q /var/www/mydomain/htdocs/app/console mautic:emails:send >/dev/null 2>&1

0 0 * * * /usr/bin/php -q /var/www/mydomain/htdocs/app/console mautic:email:fetch >/dev/null 2>&1
0 0 * * * /usr/bin/php -q /var/www/mydomain/htdocs/app/console mautic:iplookup:download >/dev/null 2>&1

Did I missed something?

Thanks

Hey all,

I would like to create campaign with condition based on a contact field value.

This is my plan:

  1. Add custom contact field: campaign-start (type date/time)
  2. Create pre-campaign. In the campaign, I add condition: “condition based on a contact field value”.
  3. I choose contact field: campaign-start , operator: date, value: is today (when save change to +P0D)
  4. Action: change campaign to campaign-followup
  5. Base on my understanding: once the campaign-start equal with today, the campaign will change from pre-campaign to campaign-followup
  6. Unfortunately, it does not work.

Did I made something wrong? Anyone made similar with this before and did worked?

Thanks a bunch.

all your cron-stuff works corretcly?

looks like https://www.mautic.org/docs/en/setup/cron_jobs.html, I’d say… But does it WORK? I needed to adjust the sequence a bit, because the script didn’t continue after console mautic:messages:send

Maybe delete all the “>/dev/null 2>&1” and run it on the shell?

Hey olafdammann,

Thank you for your reply.

Must I add:

          • /usr/bin/php -q /var/www/mydomain/htdocs/app/console mautic:messages:send ?

Thanks

Hi Sudo
…only, If you use these new marketing-mails in the campaign builder.

Wen you run your Scriptlines one by one (without " “>/dev/null 2>&1”), will it work? I think, you need to check step by step: Is the script correct? Once you have this clear (by running the lines seperately), then check if the cron works.

Don’t forget: I was guessing, that cron does’nt work. Maybe there is a thing in Mautic, which avoids it to do the math.

maybe try the same thing with the build-in date-fields and check, if this works.

OLAF

Hey Olaf,

Wen you run your Scriptlines one by one (without " “>/dev/null 2>&1”), will it work?
==> yes, they do work. No error

I try use another custom field, but it does works . Really frustrated ):

it’s working now?

just for compleeteness: THis is my cron-script:

date +"%d.%m.%Y, %H:%M:%S" > /--PATH--/mautic/df-scripts/all-crons.log

cd /--PATH--/mautic/app

#--- Segments ---------------------------------
echo "1/5 --- To keep the segments current: --------------------------------------" >> /--PATH--/mautic/df-scripts/all-crons.log
/usr/bin/env -i /usr/local/bin/php7-70STABLE-CLI console mautic:segments:update >> /--PATH--/mautic/df-scripts/all-crons.log

echo "2/5 --- Send Scheduled Broadcasts (e.g. segment emails) --------------------" >> /--PATH--/mautic/df-scripts/all-crons.log
#https://www.mautic.org/community/index.php/6553-scheduled-broadcasts-didn-t-send/0
/usr/bin/env -i /usr/local/bin/php7-70STABLE-CLI console mautic:broadcasts:send >> /--PATH--/mautic/df-scripts/all-crons.log
sleep 2m
#----------------------------------------------

#--- Campaigns --------------------------------
echo "3/5 --- To keep campaigns updated with applicable contacts: ----------------" >> /--PATH--/mautic/df-scripts/all-crons.log
/usr/bin/env -i /usr/local/bin/php7-70STABLE-CLI console mautic:campaigns:rebuild >> /--PATH--/mautic/df-scripts/all-crons.log
sleep 2m

echo "4/5 --- To execute campaigns events: ---------------------------------------" >> /--PATH--/mautic/df-scripts/all-crons.log
/usr/bin/env -i /usr/local/bin/php7-70STABLE-CLI console mautic:campaigns:trigger >> /--PATH--/mautic/df-scripts/all-crons.log

echo "5/5 --- To send frequency rules rescheduled marketing campaign messages: ---" >> /--PATH--/mautic/df-scripts/all-crons.log
/usr/bin/env -i /usr/local/bin/php7-70STABLE-CLI console mautic:messages:send >> /--PATH--/mautic/df-scripts/all-crons.log
#----------------------------------------------

And yes: M is sometimes really frustrating. I checked for alternatives, but I those are even more expensive. So I continue praying the Devs stop playing with features but stabilize the freakin core.
OLAF

Thank you for sharing Olaf.

Do you have campaign similar like this?

Thanks

you do know not all mautic scripts work with php version 7 so you will have issues, version 5.6 is the one still recomended with php. This could also be a problem with specific things with cron running.

Hey vcdesigns,

thanks for your info.

I think it’s not cron issue. I did a test by use another custom field. Let’s say if its value = ‘1’ then move the contact to another segment. Id did worked.

Maybe the problem is in checking the value on is_today() and the value in custom field. I use format Y-m-d H:i:s . Did I made a mistake?

Thanks