Skip to Content Skip to Menu

[SOLVED] Setting expiration date to CB Field

7 years 5 months ago - 7 years 4 months ago #293962 by Goosemoose
Hi Guys,

I'm trying to save plan expiration dates on a monthly recurring plan to a CB date field. I've tried quite a few things and can't seem to get it to work at all. The CB field, is of type date. I'm using Set.Field = value and the value is set to [SUBSCRIPTION_EXPIRY_DATE]. My goal is for this to update each time one of our plans renew (could be monthly or yearly). We're using this value in other programs.
Attachments:
Last edit: 7 years 4 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: 48425
  • Thanks: 8274
  • Karma: 1443
7 years 5 months ago #293977 by krileon
Replied by krileon on topic Setting expiration date to CB Field
My guess is the date substitution is coming out formatted already instead of SQL format, which means it can't be stored to a date field. You can use an SQL Action and use a database query to force formatting or just store it to a text field.


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.

7 years 4 months ago - 7 years 4 months ago #294229 by Goosemoose
Replied by Goosemoose on topic Setting expiration date to CB Field
Got it, thanks. Just in case anyone else looks for something similar, here's the SQL query I used. It took a little work to get things formatted right for a CB Date Field.
Code:
UPDATE `yourdbname`.`jos3_comprofiler` SET `cb_yourfieldname` = DATE_FORMAT(STR_TO_DATE('[SUBSCRIPTION_EXPIRY_DATE]','%m/%d/%Y'),'%Y-%m-%d') WHERE `jos3_comprofiler`.`id` = '[user_id]'
Last edit: 7 years 4 months ago by Goosemoose.
The following user(s) said Thank You: krileon

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

Moderators: beatnantkrileon
Powered by Kunena Forum