Skip to content

Commit ee6ab71

Browse files
authored
Merge pull request #3002 from port-labs/missing-related
add upsert entity limitation
2 parents eb988bf + 5eebfe1 commit ee6ab71

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

docs/actions-and-automations/setup-backend/create-update-entity/create-update-entity.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,55 @@ Here are some typical scenarios for mapping array relations:
161161
:::info Entity titles in relations
162162
Relations can only reference entity **identifiers**, not titles. Even though entity objects contain both `identifier` and `title` properties, you must always use `.identifier` when mapping to relations.
163163
:::
164+
165+
## Limitations
166+
167+
### Create missing related entities
168+
The `createMissingRelatedEntities` flag is not supported when using this backend type.
169+
170+
If you want to automatically create missing related entities, you can use the [webhook backend](/actions-and-automations/setup-backend/webhook/) instead, with an API call to the [create an entity](/api-reference/create-an-entity) endpoint. This way you can set the `createMissingRelatedEntities` flag to `true` in the API call.
171+
172+
Here is an example JSON definition of a self-service action that creates a new entity and its related entities:
173+
174+
<details>
175+
<summary>**Example action JSON definition (click to expand)**</summary>
176+
```json showLineNumbers
177+
{
178+
"identifier": "create_entity_a",
179+
"title": "Create Entity A",
180+
"trigger": {
181+
"type": "self-service",
182+
"operation": "CREATE",
183+
"userInputs": {
184+
"properties": {},
185+
"required": [],
186+
"order": []
187+
}
188+
},
189+
"invocationMethod": {
190+
"type": "WEBHOOK",
191+
"url": "https://api.port.io/v1/blueprints/<entity_a_identifier>/entities?create_missing_related_entities=true",
192+
"agent": false,
193+
"synchronized": true,
194+
"method": "POST",
195+
"headers": {
196+
"RUN_ID": "{{ .run.id }}",
197+
"Content-Type": "application/json"
198+
},
199+
"body": {
200+
"identifier": "my_new_entity",
201+
"title": "MyNewEntity",
202+
"icon": "Microservice",
203+
"team": [],
204+
"properties": {},
205+
"relations": {
206+
"<relation_identifier>": "<entity_b_identifier>"
207+
}
208+
}
209+
},
210+
"requiredApproval": false
211+
}
212+
```
213+
</details>
214+
215+
**Note** that `synchronized` should be set to `true`.

0 commit comments

Comments
 (0)