Posted: April 29, 2021 at 10:33 pm
|
Hi, We have created multiple ‘Automated Upcoming Event Notification’ messages using custom message templates that are triggered at different points prior to the Event occurring. For example, 20 days out, 2 weeks out, 2 days prior. I am trying to relate these custom message templates to the event using the model system. I can create a new instance under EE_Event_Message_Template that includes the Event Message Template ID and the Event ID, but when I try to create a relationship to the event I receive the error: So my question how do I determine the Message_Template_Group for a custm message? Is the Message Template Group the message type of ‘Automated Upcoming Event Notification’? Can I assign multiple custom messages in the same message type to one event? |
Hi there, Unfortunately, I don’t think is going to work how you are expecting. I’ll answer your questions but EE doesn’t expect multiple of the same message type per event and the AUEN add-on also has checks to prevent it from triggering the message types more than one.
Whilst you can pull in the message groups based specific message types ( Something like:
Is going to pull the message template groups for the specific message type you set. For the AUEN add-on that’s going to be EE displays those in a dropdown for the user to select one, then saves that value. You’re going to need some way to select the specific groups you need here, or hardcode them.
EE only expects a single record, so technically it’s possible to do so within the database but nowhere within EE expects multiple rows and will use The AUEN add-on also sets extra meta values in relation to the event so that the query skips events if it has already trigger notifications for that Event/DateTime so unfortunately I don’t think is going to work how you are expecting it to without further customizations. |
|
|
Thank you for the reply Tony. Do you have any suggestions on how I can get these to work or to bypass the AUEN checks that skip multiple events of the same type? |
It’s not skipping multiple events of the same type, but rather skipping an event/DateTime if that entity has extra_meta data saved to show it’s already been triggered previously. Even if you managed to save multiple templates to the event you’ll need to remove the extra meta value for this to work with the current add-on. We can’t provide support for this, the system is designed to be cautious over sending emails (we’ve had a lot of feedback over emails from EE3 and EE4) so hacking that up to allow for this is not something we can do. However, I can point you in the direction I would look into this. So if this were me, I’d look into a way to delete that extra meta value around the days when you want the messages to trigger. The Extra_Meta key (EXM_key) for the AUEN add-on is So you could have a single template set at 20 days, that will run and then save the extra_meta values. Have a function that runs on a cron schedule that pulls in all of the events with that extra_meta value set within the highest number of days you use for the message buffer. Use the datetime(s) on those events and compare to today’s date and if it’s around the time you want the ‘next’ email to go out, remove the extra_meta value (you could also set the ‘next’ upcoming event template on those events at that point). Then let the AUEN add-on do its thing the next time it runs its check. Be careful with this, getting this wrong could cause multiple emails to send and if you have many registrations on the event that could easily means hundreds/thousands of emails triggered (which is also one of the reasons it is not something we can provide support for). |
|
|
Thank you Tony. That is a HUGE help. As always, I appreciate the response. |
|
Tony So back to my first question, I have a custom message template created for the message type of ‘Automated Upcoming Event Notification’. How do I assign that one custom message template to an event. I can pull the Custom template with And I can pull the group with But how do I relate these items to the event? |
Use So something like:
|
|
The support post ‘Model System – relate custom Messages and Events’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.