I have a webform with a set of fields. When the form is submitted, a website admin needs to update a field on the form based on some criteria. I need to send an email to the sender only if the value of that field equals something.

I have tried implementing this with Rules:

  1. Event: After a webform submission has been updated.
  2. Conditions: Webform has name
  3. Action: Send HTML email

I need something else on step 2, to compare the field value submitted, but I don't see any condition for that.

Drupa 7, Webform 4.

1 Answer 1


I've been working with something that's similar enough that it might help. I'm using the FillPDF module to fill out an editable PDF and send it by email, all through rules. Different results, but I believe the roadblock you've run into is the same one I had to work with.

Let's say you want to send an email if the admin selected 'Send Email' from a submission select labelled 'send_email' that included:

yes|Send Email
no|Don't Send Email

Webform submission data aren't available within the Conditions section of a rule by default. To get around this, you need to:

  1. Install the rules_conditional module
  2. Add a variable for your submission value to compare.
  3. Create an 'if' condition within the Actions area to compare.

Install rules_conditional module.

This will allow you to write conditions in the Actions area.

Add your submission value as a variable

Add Action

  • action to add: 'Add a variable'
  • type 'Text'
  • value: from replacement patterns, pick the appropriate submission token, which will probably be [data:*{component}*-value] or [data:*{component}*-value-raw] for you, where {component} is the key of the submission data. For example [data:send_email-value-raw]. (Note that if you have grouped your webform fields within fieldsets, you'll need to add the fieldset key inline here. e.g. [data:admin_data:send_email-value-raw] if your fieldset is 'admin_data'. That little nugget took me hours to figure out.)
  • variable name: name it so you'll recognize it elsewhere within the rule (e.g. 'submission_send_email').

Note that you might need to convert the data type if your value isn't the correct type. You can add a separate action after the variable to convert it.

Add a condition below the action

  1. Add conditional

  2. Add if:

    Data comparison

    Data to compare: Your new variable (submission_send_email) should be within the list of data selectors, or you can begin typing it in the data selector field. (It'll have dashes instead of underscores: submission-send-email.)

    Value: enter the value you want to match.

Place your action within the if

A tested working example:

enter image description here

Notes: in my experience, the 'raw' forms of the submission values are the keys for selects (e.g. 'yes' vs. 'Send Email').

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.