How to id Custom Objects
Creating Records
When a record is created, it will be automatically assigned anid
. You can create your own custom ids, to match your system. For example, you could create custom object records that match the order numbers created in your online store. To assign your own custom id, useexternalId
.externalId
is optional, and if omitted when a record is created, the record can only be retrieved using the autogenerated and assignedid
field.It is recommended to use
externalId
when creating records because it makes future updates easier.Updating Records Using
id
orexternalId
Any value inid
will be ignored if there is no record matching that id. A new record will be created and given a randomly generatedid
. If an existing record has a matchingid
provided in the request body, the existing record with that sameid
will be updated.When performing a
POST
to/customObjects/records/SCHEMA_ID_HERE
:If
id
being passed in MATCHES an existing record'sid
, and the passed-inexternal-id
also MATCHES theexternalId
:
- Record is updated, neither ids are changed
If
id
being passed in MATCHES theid
of an existing record, butexternalId
DOES NOT MATCH:
- a new record is created, the
id
being passed-in is ignored and a new id is assigned, the record is also assigned with the passed-inexternalId
If
id
being passed in MATCHES an existing record'sid
, butexternalId
IS OMITTED:
- Record is updated, no
externalId
appendedIf
id
being passed in DOES NOT MATCH any existing recordid
OR IS OMITTED, butexternalId
DOES MATCH:
id
is not updated/changed, existing record is updatedIf
id
being passed in DOES NOT MATCH and existing record or IS OMITTED, andexternalId
DOES NOT MATCH or IS OMITTED:
- A new record is created, the
id
being passed in is ignored and a new id assigned, and the new record is also given that passed-inexternalId
{
"record": {
"id": "this-id-is-created-on-a-new-record-and-can-not-be-updated",
"externalId": "external-id-that-can-be-updated",
"fields": [
{
"id": "my-number-field",
"value": 100
}
],
"relationships": {
"primary-contact": [
14
]
}
}
}
{
"record": {
"id": "test-obj-1",
"externalId": "test-obj-1",
"schemaId": "6449c3f3-b68d-46d1-850b-c8aea998ce1b",
"fields": [
{
"id": "my-number-field",
"value": 100
}
],
"relationships": {
"primary-contact": [
"14"
]
}
}
}