I'm new to rules and getting stuck.

Using Profile2, one of the my profiles has a single boolean field checkbox which by default is set to 0

I simply want to change the value to 1 when a certain role is added to the account.

I have got the events and elements working as they should but can not figure out how to configure the action.

Any help would be much appreciated.

Comments

acrazyanimal’s picture

Component: Rules Core » Rules Engine

You would need to use the "set a data value" action to set it. However, depending on which event you are using the profile2 profile fields may not be exposed. You may need to use a series of "data comparison" conditions to expose the boolean field you would like to set. For any entity you want to expose the fields for you usually need to use the "data comparison" condition against the entity's bundle type.

In your case if you have a user with profile2 profile ( we'll use "example profile" for a lack of a better name ) that has a boolean fields name "example bool" you may need the following "data comparison" conditon:

Data to compare:
account:profile-example-profile:type

Click continue. Then select the relevant profile2 type from the dropdown list. Having this condition will expose all of the fields for that profile.

Then to set the value of you boolean create a "set a data value" action:
Data selector:
account:profile-example-profile:field-example-bool

mrpauldriver’s picture

Thank you. I'm still not getting anywhere and wondering if it is related to another problem I have http://drupal.org/node/1417596

tr’s picture

Component: Rules Engine » Rules Core
Issue summary: View changes
Status: Active » Closed (outdated)

If you continue to have a problem with this in the current version of Rules please open a new issue.