Understand object and relationship field updates
There are four ways to create a relationship between two objects. For example, suppose these two objects are called planet and moon. To add a new moon to a planet, there are four choices:
This table illustrates the relationship modifications on fields within a planet object or a moon object versus the relationship modifications and endpoints for POST on either a planet object’s edge or a moon object’s edge.
|
| Request type | Request example |
|---|---|
|
|
|
|
|
|
|
|
In each case, the behavior of the script invocation differs depending on the configuration. The following table shows the differences between request types and script implementations:
| Request Type | planet: field policy | planet: onValidate |
planet: onUpdate |
|---|---|---|---|
|
Yes |
Yes |
Yes [1] |
|
Not invoked |
Not invoked |
Not invoked [2] |
| Request Type | moon: field policy | moon: onValidate |
moon: onUpdate |
|---|---|---|---|
|
Not invoked |
Not invoked |
Not invoked |
|
Yes |
Yes |
Yes [3] |
Relationship derived virtual property (RDVP) calculations
RDVP calculations depend on the specific request type and the notification settings for relationships between objects.
-
For
PATCH-on-planetorPUT-on-planet:-
RDVP recalculations on the
moonobject depend on notification settings. If a recalculation is triggered onmoon, its field policy,onValidate, andonUpdatescripts are invoked.
-
-
For
POST-on-planet-edgeandPOST-on-moon-edge:-
RDVP calculation information is yet to be determined.
-
-
For
PATCH-on-moonorPUT-on-moon:-
RDVP recalculations on the
planetobject depend on notification settings. If a recalculation is triggered onplanet, its field policy,onValidate, andonUpdatescripts are invoked.
-
postUpdate and postCreate script hooks do have the new and old relationship states available.
postUpdate and postCreate script hooks do have the new and old relationship states available.