In Rules, I am trying to update/calculate a field in the User's account upon completion of a commerce payment.

The condition data selector obviously only wants to populate commerce related fields, since my Event is "After saving new payment".

How can I define my custom field in the Rules Conditions?

My attempts to set the user or current-user entity has field are unsuccessful. But I know this must be simple.

1 Answer 1


Here are the steps to get this to work (whatever your existing Rule looks like ...):

  1. Assume your current rule has some actions (= SomeRulesActions).

  2. Create a new Rules Component like so:

    • Use parameters related to the user (= say ParmUser) and payment (= say ParmPayment).
    • Add the Rules Conditions related to your custom field, which you should have available via the ParmUser.
    • Add Rules conditions identical to SomeRulesActions, using ParmUser and/or ParmPayment.
    • QA-test your Rules Component using the "Execute" link in front of it (in the Rues UI).
  3. Update your existing rule like so:

    • Delete all Rules Actions corresponding to SomeRulesActions (their equivalents are now included in the Rules Component you created in the previous step.
    • Add a Rules Action to execute the Rules Component you created in the previous step.

Easy, no?

An alternative solution where you don't need an extra Rules Component, is to rework your Rules logic by using the Conditional Rules module. If you wonder how to do that, use this link.

Ps: I'm assuming this is about D7.

  • Thank you so much for answering, apologies though, this is about D8. Been at this for 4 days now, stressed beyond belief, ready to pay money for help. Thought I started to get somewhere when i saw somebody's comment about setting a "Fetch entity by ID" action before setting the "Entity has field" condition. Did not work. I have tried likely hundreds of combinations of conditions and actions, and cant get my custom field to appear in the data selector. The field is a field I added to the User registration form, so I assumed this a child of the User entity, but my assumptions are fruitless.
    – David L.
    Mar 6, 2017 at 1:02
  • "Entity is of Bundle" is the way to expose the fields.
    – anonymous
    Nov 20, 2019 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.