Property Changed
The propertyChanged
condition tests whether a property on a node changed its value in a prescribed way. You can use this
condition to test if a node property changed at all, from a specific value or to a specific value (or both).
JSON Schema
{
"title": "Property Changed",
"properties": {
"property": {
"type": "string",
"title": "Property Name",
"required": true
},
"oldValue": {
"type": "string",
"title": "Old Value"
},
"newValue": {
"type": "string",
"title": "New Value"
}
}
}
This condition offers several different behaviors:
- if
oldValue
andnewValue
are empty, the condition will trigger whenever a property changes on a node. The property may change from any value to any other value. - if
oldValue
is provided butnewValue
is empty, the condition will trigger whenever the property changes AND theoldValue
matches. The property may change to any new value. - if
oldValue
is empty butnewValue
is provided, the condition will trigger whenever the property changes AND thenewValue
matches. The property may change from any new value. - if both
oldValue
andnewValue
are provided, then an exact match between the old property value and the new property value will be checked and the condition will only trigger on that exact match.
Example #1
Suppose you wanted to test for cases where a state
property changes.
You could set up the condition like this:
{
"type": "propertyChanged",
"config": {
"property": "state"
}
}
You might use something like this to fire off a web hook whenever the state of a node changes.
Example #2
Suppose you wanted to test for cases where a state
property changes from published
to anything else.
You could set up the condition like this:
{
"type": "propertyChanged",
"config": {
"property": "state",
"oldValue": "published"
}
}
You might use something like this to fire off a web hook to invalidate presentation tier cache whenever a node moves from published to any other state, such as archived, WIP, or draft.
Example #3
Suppose you wanted to test for cases where a state
property changes to published
from anything else.
You could set up the condition like this:
{
"type": "propertyChanged",
"config": {
"property": "state",
"newValue": "published"
}
}
You might use something like this to fire off a web hook to notify the presentation tier that a new article is being made available.
Example #4
Suppose you wanted to test for cases where a state
property changes from published
to archived
.
You could set up the condition like this:
{
"type": "propertyChanged",
"config": {
"property": "state",
"oldValue": "published",
"newValue": "archived"
}
}
You might use something like this to fire off a web hook to copy an article down to a third-party DB when a node transitions from published to archived specifically.