I'm working on an event management framework where I want to have a set of event templates, and create events based off of those templates.

I'm trying to find a way to get at and store which template a newly created event was derived from but I can't quite figure out what to do.

I tried looking at both hook_civicrm_postProcess() (which has the template_id but not the new event's id) and hook_civicrm_post() which as the newly created event id, but doesn't tell you what template it was derived from.

Can anyone think of a way to find those two values at the same time so that I can put the data in a custom field on the new event?

1 Answer 1


This is the reverse of what you're trying to do but might have the intended result:

Instead of populating the custom field after event creation, how about adding the custom field to your event template and populating it there?

  • That's a good idea, I can see how that would work. But there's a second problem. I need to be able to programmatically fetch events with the api, but custom data doesn't filter events via api. I was planning on populating a Drupal field using CiviCRM entity 2.x, but to do this I need to be able to get at both bits of data in some hook or another.... Commented Jul 13, 2015 at 18:22
  • i could get at it with: hook_civicrm_custom(), good idea on setting a value for a custom field in the template... Commented Jul 13, 2015 at 18:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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