Skip to Content Skip to Menu

issue with CB auto action Field

7 years 1 month ago #296801 by soportemarketing
issue with CB auto action Field was created by soportemarketing
Hello:

I've published some CB Auto Action Field (last version) and they don't work.

I want to change some CB Fields when user updates his profile. Eg:

triggers: onAfterUserUpdate, onAfterUserProfileSaved, onAfterUpdateUser (I put three triggers, because I didn't find which exactly is the correct when the user edits and update the profile)

field condition: cb_situacionlaboral equal to 1 (combo field, value 1, label desempleado).

action: cb_razonsocial set to NULL, and other two fields set to NULL (attached image).

I don't know what i'm doing bad.

Thanks for your help.

Attachments:

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
7 years 1 month ago #296806 by krileon
Replied by krileon on topic issue with CB auto action Field
Your condition is not a valid substitution. You're just comparing the literal string cb_razonsocial to 1, which is always false. Change cb_razonsocial to [cb_razonsocial]. See the below tutorial for substitution usage information.

www.joomlapolis.com/documentation/279-community-builder/tutorials/18353-using-substitutions-throughout-cb


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: nant

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

7 years 1 month ago #296816 by soportemarketing
Replied by soportemarketing on topic issue with CB auto action Field
Yes, now I understand why It didn't work. Thanks Krileon!!!

Is there also any URL where explained which trigger is appropiated for each event? I've let "onuserprofilesaved" alone and It works right.

Thanks again

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
7 years 1 month ago #296829 by krileon
Replied by krileon on topic issue with CB auto action Field

Is there also any URL where explained which trigger is appropiated for each event? I've let "onuserprofilesaved" alone and It works right.

No, we do not have descriptions for every trigger and likely never will (there's too many to have to keep up with). We try to ensure all new triggers explain their purpose in their name, but some of the older ones may still be a little vague. "onUserProfileSaved" for example is self explanatory. It fires when the profile has been saved. We do have the below list to help show what variables are available to triggers (I try to update it when I find time).

www.joomlapolis.com/documentation/279-community-builder/tutorials/18358-using-cb-triggers


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 1 month ago #297060 by soportemarketing
Replied by soportemarketing on topic issue with CB auto action Field
Thanks!! But...

Now I'have another issue in the same topic. I've an code auto action working, but I want to get "label" from a combo field. This is my solution:

$sitlaboral='';
[cb:if cb_situacionlaboral!=""]
if ([cb_situacionlaboral]==1) { $sitlaboral='Desempleado';}
if ([cb_situacionlaboral]==2) { $sitlaboral='Trabajador';}
if ([cb_situacionlaboral]==3) { $sitlaboral='Autonomo';}
[/cb:if]

In the field values are 1,2,3, and labels are Desempleado, Trabajador, Autónomo.

Could I make any easy substitution like [cb_situacionlaboral].[label] or similar to do this?

And, I have to do [cb:if cb_situacionlaboral!=""] before because if field is empty and I do only if ([cb_situacionlaboral]==1) { $sitlaboral='Desempleado';} ir breaks. Why?

Regards

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8279
  • Karma: 1443
7 years 1 month ago #297064 by krileon
Replied by krileon on topic issue with CB auto action Field
You're using a raw substitution, which returns the database stored value. This means for a select field for example it would indeed return 1, 2, 3. To get the label for those values you need to use the [cb:userfield field="FIELD_NAME" /] substitution usage. See substitution tutorial below for details.

www.joomlapolis.com/documentation/279-community-builder/tutorials/18353-using-substitutions-throughout-cb


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: soportemarketing

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

Moderators: beatnantkrileon
Powered by Kunena Forum