1

I'd like to be able to send an email to the nth person (or every n people) that submit a specific webform. I've tried utilizing rules for this, but I can't seem to expose webform submission data to rules (using submission id). Any thoughts on how this could work through rules? Any suggestions for alternatives?

2
  • if you are able to code it by your self, i could give you an algorithm Commented Oct 30, 2015 at 14:55
  • I'm not very great with hooks but I can give it a shot. I'd figure I would just take the modulus of the submission ID, like: if(sid%n = 0)...Not sure if that is the best way to solve this or not.
    – ADE
    Commented Oct 30, 2015 at 16:07

3 Answers 3

1

Have you tried using Webform Rules ?

This should expose webform results to rules, then create a new rule with conditions "if submission ID is 100, 200 etc" then... action: Send email.

You would either need a way to find the nth of 100, or depending on how many submissions you are expecting, just check against a comma separated list, eg "100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200" etc

3
  • I do have webform rules enabled, but I cannot seem to find anything allowing me to access the submission ID. The rule is set up to fire after a webform has been submitted, but any sort of condition I put in doesn't allow for the submission ID to be accessed.
    – ADE
    Commented Oct 30, 2015 at 15:23
  • Sometimes to use the results of a field when using entities, you have to first use a condition "Entity has field" and then select the field you want to use. There may be something similar with Webform Rules?
    – Collins
    Commented Oct 30, 2015 at 15:30
  • Unfortunately, I wasn't able to get any of the tokens to show up even after adding a field via "Entity has field". I'm able to do data comparison on the data of the submission (through the [data] token), but I'm unable to access any of the specific options of [data] (like [data:sid]).
    – ADE
    Commented Oct 30, 2015 at 15:57
1

in hook_webform_submission() there is a variable $submission. So all you need to do is to implement this hook in your custom module and check for $submission->sid accordingly to your wisches.

If condition matches: drupal_mail()

0

Use rules to add +1 to an integer field on a solitary node when a web form is submitted. Have another rule that fires when a webform is submitted and that integer field is equal to 100.

Use that rule to send an email and reset the integer to 0.

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.