Hello,
Could someone please check my logic for the following rule? I can't get it to work and don't know where I'm going wrong. Thanks!
Event: After saving a new profile
Condition: Data Comparison .. Selected data: site:current-user:profile-main:field-become-a-distributor
Action: send e-mail
Everything works fine if I remove the condition but I only want to send an email if this profile2 field has a certain value.
Here is what is in my error log:
Unable to get the data value for the variable or parameter data. Error: Unable to get the data property field_become_a_distributor as the parent data structure is not set.
thanks for any help and direction.
Comments
Comment #1
jbbourdu commentedYou might have read this before, in case you did not it might help: http://drupal.org/node/1137854
It is the same error message "Unable to get the data property xxx as the parent data structure is not set". But you are using a different event to trigger your rule: profile event instead of user creation event.
Comment #2
luthien commentedsimilar question: I need a rule to create a term for a specific vocabulary after an user profile was created. What will be the reaction rule: user account was created or profile account was created? please help, this is what I need:
1) User registers (using profile2 form)
2) User account is created but it is blocked until admin approves the account.
3) User role is assigned after admin approved the account
4) Create a term using a custom profile2 text's field.
The above workflow needs rules to work in the right order. If I add a reaction rule that the user account was created, then I dont have the profile2 tokens to create the term. What should I do to achieve above functionality?
I have another question: how can I populate the new term's fields using fields from profile2? I don't want to use taxonomy as my user profiles but I do need to connect the profiles and the taxonomy terms using a couple of fields that later on will be useful for creating products. I have two different type of profiles, only one of the profile types needs an equivalent taxonomy term for each profile that is created.
thanks
Comment #3
mortona2k commentedI've got a working rule for sending emails after profile2 creation:
Event: After saving a new profile
Condition: Data Comparison .. Selected data: profile2:type equals PROFILE_TYPE
Action: send e-mail
You're checking a field value on the current user's profile. Mine checks the type of the profile that's being created (there might be some issues with the oder of events for you, or the check I have might be required).
luthien - I think with a data comparison condition on an account update event, you can check the difference between the changed and unchanged account for the account being activated. Then load the profile from their account, and use the fields to create a taxonomy term. I haven't done this before, but that's where I'd start.
Comment #4
graysonecooper commentedI tried #3 and I get the following error:
EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format.
It is encouraging to see that this reveals the tokens for Profile2 in rules though.
EDIT: It looks like the error is thrown by the event, "A new profile is saved", rather than the data comparison...
Comment #5
tr commentedFeel free to reopen this if the problem still exists and if you can provide complete details of how to reproduce the error with the current versions of Rules and Profile 2.