0

I'm looking to use a combination of Mailhandler with either Rules or Notifications. When a volunteer creates a "note" (a node that references another node), I want to notify the author of the referenced node. The use case here is a volunteer helpdesk where a volunteer logs a note on a ticket, and the ticket's author receives an email.

It seems like a custom token to locate the ticket author's email would be useful in either situation. Is that the right approach? If so, are there any code samples of creating a D7 token that does something like this?

5

With Rules:

  1. Create a new Rule that reacts on event After saving new content.
  2. Add a condition Content is of type to the rule and select the note content type in the content types section.
  3. Add an action Fetch entity by id to the rule.
    1. As entity type, select Node.
    2. In the Identifier section, press button Switch to data selection (unless you already see an input field labeled Data selector).
    3. From the Data selectors section, find the selector that references the ticket that is associated to the note. Copy that value into the Data selector input field.
    4. In the Fetched entity section, set the variable label to "Referenced ticket" and the variable name to "referenced_ticket"
    5. Save the action.
  4. Add an action Send mail to the rule. You can now use referenced-ticket:author:mail as data selector for the recipient.
3
  • holy crap, i didn't realize Rules had gotten THAT awesome in D7! I'll try it out tonight and mark this as the answer after testing. – Nicholai Aug 24 '11 at 22:40
  • This was already possible in the Drupal 6 version of Rules. Instead of Fetch entity by id you would use Load referenced node. This would provide a token [referenced_ticket:author-mail]. – Oswald Aug 24 '11 at 22:49
  • Ahh, that makes sense. I guess I just never had a use case before now. Thanks again for the help! – Nicholai Aug 25 '11 at 2:30

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.