Update node field AFTER email sent?

Events happening in the community are now at Drupal community events on www.drupal.org.
barckhoff's picture

Hi,

I've been struggling with finding a way to update a node field after an email has been sent. I've set up the Views Bulk Operations module to send an email to selected users in a view, which seems to be working fine, but I want to be able to update a field the associated node to say that an email has been sent to that user, as part of the workflow & tracking.

I'd hoped that this patch for Mail Logger would help, but alas, it does not seem to work.

There doesn't seem to be any triggers based on system mail sent that would allow me to create a rule to update a node field.

Does anyone have any other ideas on how to do this??

Comments

OK, never mind... I figured

barckhoff's picture

OK, never mind... I figured out how to do this with rule sets.

Here's what I did:

  1. created a rule set with a content type argument (mine's a custom type)
  2. created a rule: if "email sent" value = no (CCK field) then send arbitrary email to content author
  3. created a second rule: if "email sent" value = no then populate that field with "email sent" value = yes

Another way

itangalo's picture

Another way of doing this would be to have the e-mail not being sent directly from VBO, but from a Rule set you call from the VBO.
This rule set could then do multiple actions, where the first one is to send an e-mail and the last one to update the appropriate CCK field.

The tricky part would be to get the hold of user object and the node object in Rules – VBO can currently only invoke rule sets that have exactly one argument, meaning that you'll pass the user or the node to the rule set (depending on whether you have a user view or a node view). Thus, you'll have to dig out one of the objects using the other.
If the relevant user is the author or the node it will be as easy as doing the "load user" action in rules and the author will be available. If there are more complex relations you'll probably have to do some thinking.

Good luck!
//Johan Falk, NodeOne, Sweden

Rules

Group organizers

Group categories

Categories

Group notifications

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