Skip to Content Skip to Menu

Birthday email with auto action

3 years 8 months ago #323571 by alumni-ges
Birthday email with auto action was created by alumni-ges
Hello,

i want to send a birthday email to my users. I know, that it would work with cron and an auto action. But how can i make a auto action batch with a condition to compare the actual date with the birthday. I found this in an older post:

Conditional: date(m-d,strtotime([cb_birthdate])) Equal To strtotime([cb:date format="m-d" /])
You could also try the below.
Conditional: strtotime([cb_birthdate]) Less Than or Equal To strtotime([cb:date format="m-d" /])

But i can only choose a field in the dialog. Where can i put in the condition to only compare the date and the month of the field?

Thank you for your help.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • OFFLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
3 years 8 months ago - 3 years 8 months ago #323573 by krileon
Replied by krileon on topic Birthday email with auto action
You'll have to use format functions for that. They're special substitutions that let you run various functions against your values. You can see all the available format functions under the Parameters tab. The below should work.

Field: Custom > Value
Custom Value: [cb:parse function="date" date-format="m-d" time="false" offset="UTC"]now[/cb:parse]
Features: Format Functions
Operator: Equal To
Value: [cb:parse function="date" date-format="m-d" time="false" offset="UTC"][cb_birthdate][/cb:parse]
Features: Format Functions

That should compare the current month and day to the month and day of your date field named cb_birthdate.

You will not be able to do this within the Batch behavior since the Batch usage directly modifies the database query. The best way to do this in the Batch behavior is under Advanced Filter to write the necessary SQL to do this from a database level so you do not have to process your entire userbase looking for a birthdate. There are several examples of how to do this across the web. For example the below should work.

WHERE
Code:
MONTH( `cb_birthday` ) = MONTH( CURDATE() ) AND DAY( `cb_birthday` ) = DAY( CURDATE() )


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Last edit: 3 years 8 months ago by krileon.

Please Log in or Create an account to join the conversation.

3 years 8 months ago #323577 by alumni-ges
Replied by alumni-ges on topic Birthday email with auto action
Hello again,

i cannot find the field to put in the parse function (appended Screenshot) in auto action for further uses.

I will try it in auto action batch with your tipp. But i use a german version of cb. Should i use "cb_birthday" or "cb_geburtsdatum" (which is displayed in the dialogs)?

Thank you again.
Attachments:

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • OFFLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
3 years 8 months ago #323580 by krileon
Replied by krileon on topic Birthday email with auto action
You have to use the Batch feature if you are intending on using this with CRON. The Batch feature just takes your database of users, filters them down, then runs them through your selected auto actions. So it's best to filter these at the database level. See my above reply for example of how to do that.

As for the format function usage if you still want to run your entire database through the auto action instead of filtering first then that's just a condition applied to your auto action under the Conditions tab.

I will try it in auto action batch with your tipp. But i use a german version of cb. Should i use "cb_birthday" or "cb_geburtsdatum" (which is displayed in the dialogs)?

What I have provided is just an example. Use the name of the field you use for your cb_birthdate/birthdate field. If that's cb_geburtsdatum then yes you'd use that.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

3 years 8 months ago #323602 by alumni-ges
Replied by alumni-ges on topic Birthday email with auto action
Thank you very much for your help. It is some years ago, that i createtd the fields and therfore i did not know if it is a standard field.

Please Log in or Create an account to join the conversation.

3 years 8 months ago #323639 by alumni-ges
Replied by alumni-ges on topic Birthday email with auto action
Hello again,

now i have all configurated in Auto action and batches. If i copy the Internal URL to a browser, than he ask me for a login. Afterwards the auto action is done succesfull. If i take the same URL and put it in PLESK under task planning and start the execution for now, all seams to work. There is no error displaying, but the auto action is not executed succesfully. Is there any trick with the URL to make it works in combination of login data of cb.

Thank you for your help.
Attachments:

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum