[SOLVED] CB Auto action trigger and conditions value

5 years 4 months ago - 5 years 4 months ago #309259 by systems
Hi,
I am hoping someone can help me. I wish to create a private message to be sent to a user when their field cb_expirydate is 4 weeks from today.
I dont know which trigger to use as I need to check all users once daily. I am also having trouble with the condition. I have got cb_expirdate is greater than [cb:date format="Y-m-d" /] but need to add 4 weeks to today's date. Any suggestions would be much appreciated.
Thanks in advance

Please Log in to join the conversation.

5 years 4 months ago #309279 by krileon
Replied by krileon on topic CB Auto action trigger and conditions value

I dont know which trigger to use as I need to check all users once daily.

You'll need to use the Internal Users trigger which will loop the auto action through every user on your site. However at this time it has no batching behavior so it's an extremely heavy operation. I recommend just checking this per-user on the after user login trigger. This way it only sends the PM to active users after they login. If you still want to use Internal Users you can trigger auto actions acting on that trigger with the URL in CB Auto Actions > Parameters.

I am also having trouble with the condition. I have got cb_expirdate is greater than [cb:date format="Y-m-d" /] but need to add 4 weeks to today's date. Any suggestions would be much appreciated.

Ensure you've the Format checkbox checked. This will enable the format functions found under the Parameters tab. You'll need to convert the date to a timestamp then compare it. Below should work.

[cb:parse function="time"][cb_expirdate][/cb:parse] Greater Than or Equal To [cb:parse function="time" time="+4 WEEKS"]now[/cb:parse]


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 to join the conversation.

5 years 4 months ago #309297 by systems
Replied by systems on topic CB Auto action trigger and conditions value
Thanks Krileon, much appreciated. Your suggestion of using after user login makes sense as they wont see the message until they log in anyway. Ill give that a go. Thanks again!

Please Log in to join the conversation.

5 years 4 months ago #309298 by systems
Replied by systems on topic CB Auto action trigger and conditions value
Sorry, but is there a way to make the PM only send once per user.

Please Log in to join the conversation.

5 years 4 months ago #309307 by krileon
Replied by krileon on topic CB Auto action trigger and conditions value
Not without a means of tracking if the user has been sent that specific PM. You could use a checkbox field to keep track of that for example. You'd then use the same auto action setup as the PM to toggle the checkbox field to a value of 1 and in your PM auto action you'd condition to make sure that checkbox field isn't equal to 1. PM auto action should be executed before the field auto action. I suppose you could also create a custom database table to keep track of if they were sent the PM, which would require a query action to insert a row in the database after the PM is sent then use a CB Query Field to return if they were PMed or not and then condition against that.

Basically you need state management, which you'll have to implement as CB Auto Actions can't do that for you, but does give me an interesting idea to see if I can extend CB Auto Actions in the future to limit number of executions per user or something of the sort.

forge.joomlapolis.com/issues/7387


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 to join the conversation.

5 years 4 months ago #309320 by systems
Replied by systems on topic CB Auto action trigger and conditions value
Awesome.
Thanks once again for your help. Very prompt. Hard to find service like that!
You have got me out of a hole.
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.605 seconds

Facebook Twitter LinkedIn