I have a list of email addresses displayed in a view. I'd like to parse those email addresses using a rules action, via VBO.

I'm trying to pass the email address to my rules action as a parameter, but it seems the only way I can do this is if I declare the email address as an entity first. Is that right or am I missing something? If there's an easier way, please let me know.

  • Where do you have that email address? In the user entity? What's the base table of your view? Usually you could load the entity in rules and access its fields within a loop. – mariomc Jul 19 '13 at 14:29

[I'm assuming you have a custom table to store these email addresses and are not related to any other entity] With the latest version of VBO, yes, you have to define an Entity. See this issue in the VBO queue for more information.

FYI, the below steps worked for me.

function module_entity_info() {
  return array(
    'MY_NEW_ENTITY_TYPE' => array(
      'label' => t('MY_NEW_ENTITY_TYPE'),
      'base table' => 'MY_NEW_TABLE',
      'entity keys' => array(
        'id' => 'your_tables_primary_key',

Note that in entity keys array, set the table's column as the key, and VBO will pick it up and will pass as an object to the action. See below:

function module_action_info() {
  return array(
    'module_remove_something' => array(
      'type' => 'MY_NEW_ENTITY_TYPE',
      'label' => 'Remove URL',
      'configurable' => FALSE,
      'behavior' => array('deletes_property'),

In your views integration file, you will probably need to define the tables as an entity too.

function mymodule_views_data() {
  $data['mymodule_emails'] = array(
    'table' => array(
      'base' => array(
        'field' => 'eeid',
        'title' => 'Extracted E-mails',
        'help' => 'Email addresses collected by parsing the remote URL',
      'group' => 'E-mail',
      'defaults' => array(
        'field' => 'email',
      'entity type' => 'MY_NEW_ENTITY_TYPE', // attention here!
   // Rest of the table definition...
| improve this answer | |
  • Hang on, did you try doing this with hook_rules_action_info (as opposed to hook_action_info)- just wondering if there was a shortcut. – cjm2671 Jul 19 '13 at 21:24
  • Not sure, but it looks like this hook still requires an entity defined because VBO pulls up all actions for the given entity. – AyeshK Jul 20 '13 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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