Skip to Content Skip to Menu

🕒 Save Time and Effort with CB Editor Assistant: Effortlessly create and refine content in Joomla 3, 4, & 5.
🎁 Limited Offer: Enjoy a 5-day FREE trial and save up to 30% afterward!

A tricky auto action

12 years 1 month ago - 12 years 1 month ago #216881 by edmundcheong
A tricky auto action was created by edmundcheong
Okay here's a tricky auto action.

The auto action type is "Field"

I would like to populate/alter a field if one of the conditions (which is another field in the profile is the same as "another" user profile).

For example, User01's cb_department=human-resource and his cb_level=high..

When a new user, say User02 registers, he selects his cb_department=human-resource.. I would like the auto action to fire upon registration and populate User02's cb_level to "high" because his cb_department is the same User01's cb_department.

Meaning that the auto action needs to look for another user or user(s) with a cb_department of the same value and populate the cb_level field..

I hope you understand.. I am working around the value of the field should be something like this:

Field to alter: level (cb_level)
Operator: Set (Field=Value)
Value: [cb:userdata field ="cb_level" cb_department="***is the same as some other user's cb_department***"]
Last edit: 12 years 1 month ago by edmundcheong.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48709
  • Thanks: 8319
  • Karma: 1447
12 years 1 month ago - 12 years 1 month ago #216900 by krileon
Replied by krileon on topic Re: A tricky auto action
You'll need to use a CB Query Field to perform a database query and find an existing user of a department and grab their level then supply it as the value for your field. Example as follows

Query Field (cb_query):
Code:
SELECT `cb_level` FROM `#__comprofiler` WHERE `cb_department` = '[cb_department]' LIMIT 1

Field: Level
Operator: Set
Value: [cb:userfield field="cb_query" /]


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: 12 years 1 month ago by krileon.
The following user(s) said Thank You: edmundcheong

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

12 years 1 month ago #216948 by edmundcheong
Replied by edmundcheong on topic Re: A tricky auto action
Thank you so much.. i need to start learning to manipulate the other tools as well.. thanks for showing me the way!

Just another scenario..

if i have multiple conditions, should i write the query the following way.. example below is for 2 conditions (cb_department and cb_unit)

SELECT `cb_level` FROM `#__comprofiler` WHERE `cb_department` = '[cb_department], `cb_unit` = '[cb_unit]' LIMIT 1

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48709
  • Thanks: 8319
  • Karma: 1447
12 years 1 month ago #216971 by krileon
Replied by krileon on topic Re: A tricky auto action
You don't separate where statements with a comma, you need to separate them with AND. Please see the below MYSQL documentation and MYSQL tutorial.

MYSQL Documentation: dev.mysql.com/doc/refman/5.6/en/index.html
MYSQL Tutorial: www.w3schools.com/sql/default.asp


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.

Moderators: beatnantkrileon
Powered by Kunena Forum