Webform Rules - Create an unscheduler for email notifications

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
websitetechnician's picture

Hi,

On a Drupal 6 site I've created a setup similar to the old signup module using webform 6.3, rules, rules scheduler, webform rules, webform broadcast, node clone, and a custom permissions module (plus workflow and revisions to handle content editing.) This suite of modules creates a setup for events postings where content providers can create pre-templated events that include body copy and our standard webform fields.

Content providers create new events using node clone on any particular template so each event has its own unique node id.

Using rules I set up a triggered rule that operates on the event: after a webform has been submitted
The if checks to see if the content type is correct
The do are send mail to an arbitrary email address and a rules scheduler for an email that is triggered to go out 1 day before the event.

The triggered rule email goes out to the email address provided in the webform, from an email specified on the events cck. I use tokens throughout the email to provide them with information regarding the event they signed up for.

My ruleset uses the webform and content variables, and is also a send email to arbitrary email with token replacements.

My scheduled rule is set to use webform data: the submitted webform data with content being the webform node. I set my identifier as the [data:sid] token that schedules for the day before the event.

All of this works fine. What I need to do now is set up another triggered rule or ruleset to remove a scheduled email if the event is cancelled. I setup a workflow state of cancelled so I set my triggered rule to work off of workflow state has changed, then it checks if workflow state is cancelled.

I have the delete scheduled events option available but I can't pull in my unique identifier of [data:sid] from the webform. I see that I can delete all scheduled actions for my rule set but this would remove all emails, which won't work as there can be several events currently accepting signups at any given time.

I'm looking for a way to tie the [data:sid] field with the node id so I can remove only those submission ids that belong to the specific node that has been unpublished. I know the data exists in the webform_submissions table, and the node ID exists within the rules scheduler arguments field.

I also tried going the VBO route, but unfortunately there are no bulk operations available to execute on a view of webform submissions.

I'm thinking this is going to need to be some custom php, but don't really know what direction I need to go in to load both the NID and SID at the same time so I can load all SID's from the cancelled node.

Thanks in advance,

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: