Rules + Button Field: getting entity object to a custom action I am using Rules 7.x-2.2 with the latest version of Button Field (http://drupal.org/project/button_field), Session API (http://drupal.org/project/session_api) and a custom module to store some entity values in a user's session when they click a button.

To clarify, I have an entity type (Commerce product) with an HTML instance of the button field that is supposed to trigger a custom defined rules action, where I want to extract some values from the entity object that the button is associated with.

This is how my Rules action info looks currently in my custom module:

function commerce_custom_box_rules_action_info() {
    return array(
        'commerce_custom_box_add_to_box' =&gt; array(
            'group' =&gt; t('Commerce Custom Box'),
            'label' =&gt; t("Add the product to the user's box"), 
            'parameter' =&gt; array(
                'entity' =&gt; array(
                    'label' =&gt; t('Product entity'),
                    'description' =&gt; t('The entity the clicked button is attached to.'),
                    'type' =&gt; 'entity',
                ),
            ),
        ),
    );
}


And here is how my rule looks:



The problem is, in commerce_custom_box_add_to_box() (the function fired by my custom action), I have tried using dpm() on all of its arguments and none of them contain any entity properties, field values, or anything else that could even be remotely useful. All I get are empty "EntityDrupalWrapper" objects and similar. However, if I replace the action in the rule with "Execute PHP Code", there is an $entity object available there and dpm() reveals that it is in fact populated with all the usual properties.

Naturally I am trying to figure out why that object is there but isn't being received by my custom action. Perhaps I'm thinking about it in the wrong way?

A fresh pair of eyes on this would be hugely appreciated! Happy to provide more info if needed.
It turns out this was caused by the parameter type I used. I set it to "entity", whereas it should be the machine name of the entity type. Changing it to "commerce_product" has fixed the problem.