Skip to Content Skip to Menu

[SOLVED] CB Auto Action not triggering as expected

  • autobahn
  • autobahn
  • ONLINE
  • Posts: 202
  • Thanks: 38
  • Karma: 4
6 years 6 months ago - 6 years 5 months ago #304686 by autobahn
I am trying to set a field value when a subscribed member renews their subscription.

I have set up a CB Auto Action with a trigger of onCPayAfterPlanRenewalSelected, access to All Registered Users (Custom ACL) and Registered (CMS ACL), and an Action to set the field value to 1.

If I log in at the front end as a user whose renewal is due and select Renew, the subscription renews correctly but the required value is not updated. What am I doing wrong?

Thanks
Last edit: 6 years 5 months ago by krileon. Reason: Added [SOLVED] tag to subject

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
6 years 6 months ago #304697 by krileon
Replied by krileon on topic CB Auto Action not triggering as expected
You need to extend on the below usages to specifically check for a renewal.

Plan Active
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
1: [var3] Equal To PLAN_ID_HERE
2: [var2] Equal To A

Plan Expired
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
1: [var3] Equal To PLAN_ID_HERE
2: [var2] Not Equal To A

Example as follows.

Plan Renewed
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
1: [var3] Equal To PLAN_ID_HERE
2: [var2] Equal To A
3: [var7] Equal To R

For that trigger [var7] is $reason, which can have a value of N for new subscription, R for renewal, and U for upgrade. With the above it's checking that their subscription is active and is a renewal.


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.

  • autobahn
  • autobahn
  • ONLINE
  • Posts: 202
  • Thanks: 38
  • Karma: 4
6 years 6 months ago #304721 by autobahn
Replied by autobahn on topic CB Auto Action not triggering as expected
Thank you for such a prompt and comprehensive response.

I was way off track with my approach, it would seem :(

By following your example I was able to set up and test a new auto-action and achieve the desired result. I had forgotten that I need the same thing to happen on an upgrade, so your note about the values of $reason is most helpful.

Does the auto-action have to be plan-specific?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
6 years 6 months ago #304726 by krileon
Replied by krileon on topic CB Auto Action not triggering as expected

By following your example I was able to set up and test a new auto-action and achieve the desired result. I had forgotten that I need the same thing to happen on an upgrade, so your note about the values of $reason is most helpful.

Be sure you're using a Is REGEX operator in that case then use REGEX to create an OR condition. Example as follows.

[var7] Is REGEX /R|U/

That should cover both renewal and upgrade. The alternative is just checking that it's not a new subscription, but that could cause issues if we ever add more $reason values. That'd just be done as follows.

[var7] Not Equal To N

Does the auto-action have to be plan-specific?

Nope, just remove that condition if you don't want to check for a specific plan.


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.
The following user(s) said Thank You: autobahn

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

  • autobahn
  • autobahn
  • ONLINE
  • Posts: 202
  • Thanks: 38
  • Karma: 4
6 years 6 months ago #304740 by autobahn
Replied by autobahn on topic CB Auto Action not triggering as expected
Brilliant!

Thank you so much for taking the time to write out the regex (I never can get my head round them). I have updated the auto-action as you suggested and it works perfectly. The ability to use auto-action in this situation has solved a really major problem for us.

I am really most grateful for your help so thank you very much.
The following user(s) said Thank You: nant, krileon

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

Moderators: beatnantkrileon
Powered by Kunena Forum