DrupalCon Baltimore: 161 sessions, many voices, infinite possibilities. Earlybird rate ends Friday.
Please note that when using Rules in conjunction with Entity I have noticed that 'Set a data value' will only work and write data to a field if that field has or 'used to have' data contained within it. If the field is brand new/fresh and has never had any data the 'Set a data value' will not write to it.
I have posted an fully descriptive issue in Rules http://drupal.org/node/1935170 but now think it might be to do with Entity?
To reproduce try the following:
1. Install Profile2.
2. Go to 'Profile Types'
3. 'Add a profile type'.
4. 'Manage fields'
5. 'Add a new field' - a 'text' field for instance. Do the usual saves etc.
6. Create three different user profiles.
7. Add data to the 'text field' of one of them, save and leave it there. Do the same for the second user but this time go back into the profile and delete the data from the the text field so nothing is there again. On the third user do not do anything to profile i.e do not edit or save so it's never had any data contained within it.
Now to add the rule - there's various ways to test and they all have the same problem with not being able to save data but for now just try method below or any method of your choosing
8. 'Add a new rule'
9. Event ' User has logged in'
10. Condition 'Entity has field', Parameter:Entity [account:profile-name-of-profile], Field: [name of field]
11. Actions. 'Show a message on the site' (this is to show whether the rule is working or not to this point). Choose what ever message you want.
12. Add the final Action (which is the main problem with this issue). 'Set a data value'. Parameter: Data:[account:profile-name-of-profile] Value: [any text].
Now to test the rule
13. Login for one by one for all the three users. You will notice that the data will be set for the first two users but not the third (where data has never been set). But please notice user 2's data is set even though there is no data which had been deleted. I believe it has been set because Drupal is aware that it 'used' to have data present.