---
title: Understand object and relationship field updates
description: 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:
component: pingidm
version: 8.1
page_id: pingidm:objects-guide:object-relationship-update-differences
canonical_url: https://docs.pingidentity.com/pingidm/8.1/objects-guide/object-relationship-update-differences.html
keywords: ["Data Object Model", "Relationships"]
section_ids:
  rdvp-calc: Relationship derived virtual property (RDVP) calculations
---

# Understand object and relationship field updates

There are four ways to create a [relationship](relationships.html) between two [objects](managed-objects.html). 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                                                                                                                                                                                    |
| ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `PATCH-on-planet` or `PUT-on-planet` | ```none
PATCH managed/planet/saturn
[{ "operation" : "add", "field" : "/moons/-", "value" : { "_ref" : "managed/moon/titan" } }]
(or PUT managed/planet/saturn with fully-updated moons array)
``` |
| `POST-on-planet-edge`                | ```none
POST managed/planet/saturn/moons?_action=create
{ "_ref" : "managed/moon/titan" }
```                                                                                                      |
| `POST-on-moon-edge`                  | ```none
POST managed/moon/titan/planet?_action=create
{ "_ref" : "managed/planet/saturn" }
```                                                                                                     |
| `PATCH-on-moon` or `PUT-on-moon`     | ```none
PATCH managed/moon/titan
[{ "operation" : "add", "field" : "/planet/-", "value" : { "_ref" : "managed/planet/saturn" } }]
(or PUT managed/moon/titan with fully-updated planets array)
``` |

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 types and planet script invocations**

| Request Type                         | planet: field policy | planet: `onValidate` | planet: `onUpdate`                                   |
| ------------------------------------ | -------------------- | -------------------- | ---------------------------------------------------- |
| `PATCH-on-planet` or `PUT-on-planet` | Yes                  | Yes                  | Yes \[[1](#_footnotedef_1 "View footnote.")]         |
| `POST-on-planet-edge`                | Not invoked          | Not invoked          | Not invoked \[[2](#_footnotedef_2 "View footnote.")] |

**Request types and moon script invocations**

| Request Type                     | moon: field policy | moon: `onValidate` | moon: `onUpdate`                             |
| -------------------------------- | ------------------ | ------------------ | -------------------------------------------- |
| `POST-on-moon-edge`              | Not invoked        | Not invoked        | Not invoked                                  |
| `PATCH-on-moon` or `PUT-on-moon` | Yes                | Yes                | Yes \[[3](#_footnotedef_3 "View footnote.")] |

## 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-planet` or `PUT-on-planet`:

  * RDVP recalculations on the `moon` object depend on notification settings. If a recalculation is triggered on `moon`, its field policy, `onValidate`, and `onUpdate` scripts are invoked.

* For `POST-on-planet-edge` and `POST-on-moon-edge`:

  * RDVP calculation information is yet to be determined.

* For `PATCH-on-moon` or `PUT-on-moon`:

  * RDVP recalculations on the `planet` object depend on notification settings. If a recalculation is triggered on `planet`, its field policy, `onValidate`, and `onUpdate` scripts are invoked.

***

[1](#_footnoteref_1). The object state doesn't show a new relationship because it hasn't been persisted. However, `postUpdate` and `postCreate` script hooks do have the new and old relationship states available.[2](#_footnoteref_2). The object state doesn't show a new relationship because it hasn't been persisted.[3](#_footnoteref_3). The object state doesn't show a new relationship because it hasn't been persisted. However, `postUpdate` and `postCreate` script hooks do have the new and old relationship states available.
