I am writing a rule to store Tenant field's value to Previous tenant field whenever the Tenant field is updated and saved. The following are apartment and tenant content types.
Apartment content type:
- Room
- Tenant (entity reference to Tenant content type)
- Previous Tenant (unlimited number of values is set for this field)
Tenant content type:
- Name
- Phone
And this is my rule:
{ "rules_tenant_records" : {
"LABEL" : "Tenant records",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "node_update--apartment" : { "bundle" : "apartment" } },
"IF" : [
{ "entity_has_field" : { "entity" : [ "node-unchanged:field-tenant" ], "field" : "field_tenant" } }
],
"DO" : [
{ "data_set" : {
"data" : [ "node:field-previous-tenant" ],
"value" : { "value" : [ "[node:field-tenant]" ] }
}
}
]
} }
It does not work, any suggestion?