3

I have about 50,000 contacts to update and I have a scheduled update greeting job set up (based on this post Update addressee values for all contacts after modifying Addressee Type Options - thanks Sean!)

If I run the scheduled job, it never completes (it hits a max execution time limit.) I did find that I can limit the number of contacts (to say 2500) with the limit parameter, and the job will complete. But my assumption is that if I run the job again it just updates my first 2500 contacts over again. Is that a correct assumption?

Is there another way I can update the contact.addressee token in batches to avoid hitting the max execution time?

1

There are several solutions. I'll go from least to most work - though the "least work" solutions generally need a level of expertise that the "most work" solutions don't.

  • You can edit your max_execution_time in php.ini.
  • The default execution time when running from the command line is unlimited. So you could run cv api Job.update_greeting or the equivalent using drush or wp-cli if you don't have cv installed.
  • Greetings are updated whenever a record is updated. An easy way to batch update records is to import a list of all the contact IDs you want to update with no other info. This will force an update and thus a greeting update.
  • You can delete all your addressee values that need updating (or all of them!) through MySQL/phpMyAdmin, then use "Update Greetings" with a limit of 2500 and set force equal to 0. With force equal to zero, only contacts without addressees will be updated, so you won't do the same 2500 every time.
| improve this answer | |
  • Thanks for the detailed listing. The second option is appealing - I don't have cv installed but am running on Drupal. Do I need anything extra installed to use the Drush method? – RayWright Aug 30 '18 at 17:01
  • Nope - you might want to confirm that PHP has an unlimited max_execution_time on command-line, but assuming so, the command is just drush civicrm api Job.update_greeting. – Jon G - Megaphone Tech Aug 31 '18 at 16:09
  • 1
    We opted to try the drush option first - and it worked!! Some random tidbits for anyone that might happen across this post. I had to run the drush command as apache, it also required me to add the ct and gt parameters. My final command was(after telling it to run as apache) /path/to/drush civicrm-api Job.update_greeting ct=Individual gt=addressee force=1 – RayWright Sep 14 '18 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.