Hi,

1.) In Before Save EntityForm Event (or any other Before Save Event as tested like Node)

2.) Show A System Message:
Old Value: [entityform-unchanged:field-name]
Updated Value: [entityform:field-name]

3.) Send A Mail
Old Value: [entityform-unchanged:field-name]
Updated Value: [entityform:field-name]

4.) If the EntityForm is a new submission, means no value in [entityform-unchanged:field-name] , then the Entire Action of the Show A System Message and Send A Mail will be completely IGNORED. Is this the right behaviour ? If the unchanged value is not avalaible, it should display nothing instead of blocking the firing of the action completely.

To circumvent this, I have to separate the display of Old Value & Updated Value into 2 Actions, same to the email.

Thanks

Comments

TR’s picture

Status: Active » Closed (works as designed)

I'm going to mark this "works as designed".
If the variables are not available, then the Rule should fail integrity check and not execute.

If you have an action that should operate only on updated entities, then you should be using the "After saving an updated entity" event.

The "Before saving an entity" event is explicitly for both new and updated entities. Because you want to display "unchanged" values, you should not be using this - new entities will not have unchanged values.

Another way to deal with this is to use a module like Mime Mail or HTML Mail, which allow you to specify a template for your mail message. Then you could add some conditional logic into your template to display a different message depending on which variables were available.