How to id Custom ObjectsCreating 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.externalIdis optional, and if omitted when a record is created, the record can only be retrieved using the autogenerated and assignedidfield.It is recommended to use
externalIdwhen creating records because it makes future updates easier.Updating Records Using
idorexternalId
Any value inidwill 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 matchingidprovided in the request body, the existing record with that sameidwill be updated.When performing a
POSTto/customObjects/records/SCHEMA_ID_HERE:If
idbeing passed in MATCHES an existing record'sid, and the passed-inexternal-idalso MATCHES theexternalId:
- Record is updated, neither ids are changed
If
idbeing passed in MATCHES theidof an existing record, butexternalIdDOES NOT MATCH:
- a new record is created, the
idbeing passed-in is ignored and a new id is assigned, the record is also assigned with the passed-inexternalIdIf
idbeing passed in MATCHES an existing record'sid, butexternalIdIS OMITTED:
- Record is updated, no
externalIdappendedIf
idbeing passed in DOES NOT MATCH any existing recordidOR IS OMITTED, butexternalIdDOES MATCH:
idis not updated/changed, existing record is updatedIf
idbeing passed in DOES NOT MATCH and existing record or IS OMITTED, andexternalIdDOES NOT MATCH or IS OMITTED:
- A new record is created, the
idbeing 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"
]
}
}
}