I am attempting to send an email to a field selected value using the Rules module. The user selects a faculty member and saves the node. The rule should fire off and email based on the field's key. I have the field set up as:
[email protected]|Doe, John
I am attempting to send to the key using [node:field-advisor-:key]
as a replacement pattern. But I think it's still trying to send to the label.
I am still very new to Drupal so my vocabulary and skills are relatively limited.
Here is the exported rule:
{ "rules_email_to_adviser" : {
"LABEL" : "Email to Adviser",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "node_insert--timeclock" : { "bundle" : "timeclock" } },
"IF" : [
{ "user_has_role" : { "account" : [ "node:author" ], "roles" : {
"value" : { "20" : "20" } } } },
{ "entity_has_field" : { "entity" : [ "node" ], "field" : "field_advisor_" } }
],
"DO" : [
{ "mail" : {
"to" : "[node:field-advisor-:key]",
"subject" : "Time Card Submitted for Review",
"message" : "[node:author] has submitted a time card for your approval. \r\n\r\nPlease review the time card at: [node:edit-url]\r\n\r\nThank you.",
"language" : [ "" ]
}
}
]
}
}
Notes:
- All of the faculty members (such as "John Doe") have accounts on the site.
- If it would help (simplify things) to make the rule work, I'm OK with replacing the implementation of that
field_advisor_
-field by a more appropriate field (with similar functionality).