I have been trying to get the Message Notify example to work using Rules instead of custom code. I can get the email to be sent but when trying to duplicate this part of the code in rules it doesn't save the rendered data:

$options = array(
        'rendered fields' => array(
          'message_notify_email_subject' => 'field_rendered_subject',
          'message_notify_email_body' => 'field_rendered_body',
        ),
      );

I then wrote a custom function to see if I could make it work exactly like Message Notify Example and it worked without trouble. I also noticed rules was throwing an error " Unable to get a data value. Error: Unknown data property field_message_rendered_subject. " The field_message_rendered_subject is a text field. I also tried this as a long text field but it didn't seem to matter.

My conclusion is there is something wrong with saving the Rendered Subject Line and Rendered Body fields with Rules. I don't have time right now to dig into it but I wanted to see if anyone else had this issue or had any ideas on how to fix it.

Comments

discipolo’s picture

Am in a similar situation. Only for me the error message I get after enabling rules debug log is

Unable to get a data value. Error: Unknown data property message_commerce_body

the mail with message is sent but missing order information. This only happens for me with paypal though, the PayPal redirect seems to loose the session and won't include order details even in admin notifications.

9802008’s picture

@discipolo check out: https://www.drupal.org/node/1895418, in particular patch with comment 9. The issue appears to be that when the payment gateway (eg Paypal) redirects back to the Drupal website, the user is anonymous, ie can't access the view that generates the order items, hence the email is empty.

kt2ssh’s picture

try abstract.inc line 132

if ($save) {
+ $message->field_message_subject[LANGUAGE_NONE][0]['value'] = $output[$view_mode]; // assign title to field_message_subject
$message->save();
}

jelo’s picture

I have the same problem with a rules integration for message subscribe (which is based on the message notify rules integration). I am confused why the option for Subject and Body is exposed in the configuration screen in the first place? My rule looks like this:

1) Upon event, create new entity of type message.
2) Use "Set a Data Value" to provide the required entity references in the message entity
3) "Send message with message notify".

The configuration screen in step 3 asks for items such as Save on fail, Save on success, Subject and Body fields. However, the message has already been created in step 1 (which includes the partials for subject and body). To me these options don't make sense at this stage. The message sends correctly without any of these fields being used.

Additional complication is that subject and body field are empty, i.e. it does not show the partials. If I manually add fields to the message called message_subject and message_body they appear in the dropdown. However, as soon as I pick one of those, submitting a content piece that triggers the rule leads to a fatal error on the site.

What is the purpose of these two fields?

bluegeek9’s picture

Status: Active » Closed (outdated)