Create Custom Objects
In this article
Overview
If Segments and Companies are not enough, you can use Custom Objects to easily structure your data into buckets that work best for you. You can organize your data Deals, Orders, Invoices, Teams, Subscriptions, and many more.
Create Custom Objects Manually
Before you can create any Objects from class Custom Object, you'll need to Define what the Custom Object represents. There are 3 steps in defining a Custom Object.
- Define Custom Object
- Define Custom Object Properties
- Define Custom Object Association Type.
Note: Custom Object Association Type can only be defined through the API.
1. Define Custom Object
Go to Manage > Custom Fields > Create Custom Object
Then, add the name of the Object both in Singular and Plural.
Click Create and the Custom Object will be defined.
2. Define Custom Object Properties
Each Custom Object will be created with 4 default properties:
- Id
- External Id
- Created At
- Updated At
If you'd like to define additional Object Properties go to Manage > Custom fields > Add Custom Field
Name the property and choose its data type. Finally, make sure you select the correct Object you want the property to belong to.
Then, add the name of the property and choose its data type. Finally, make sure you select the correct Object the property belongs to.
3. Define Custom Object Association Types
The final step is to define the association types your Object will have access to. This step can only be performed through the Encharge API by making a POST
request to api.encharge.io/v1/schemas/associations
You can find the full schema request details here.
4. Create an Object from class Custom Object
Once ready with the definition of the Custom Object, you can begin creating instances of that Custom Object class. To do that click on People > Custom Object (in this example we'll be creating an Invoice from the class Invoices)
Click on Add Object (Invoice), fill in the Property Values and save the Object.
Create Custom Objects using the Encharge API
- Defining Custom Objects/Properties/Associations documentation
- Managing Custom Objects/Properties/Associations documentation
1. Define Custom Object Schema
To create a custom object, you'll first need to define the object schema by making a POST
request to api.encharge.io/v1/schemas
You can find the full schema request details here.
Note: Once you define an object, the object's name cannot be changed.
2. Define Custom Object Fields
To create Custom Object Fields make a POST
request to api.encharge.io/v1/schemas/{objectName}/fields
You can find the full request details here.
Note: If you need to add additional Fields at a later stage, you'll need to perform this step again.
3. Define Custom Object Association Type
To define Custom Object Association Types make a POST
request to api.encharge.io/v1/schemas/associations
You can find the full request details here.
Note: If you need to add additional Associations at a later stage, you'll need to perform this step again.
4. Create Custom Object
Once you've defined your Object, you can create Objects by making a POST
request to api.encharge.io/v1/objects/{objectName}
You can find the full request details here.
5. Associate Custom Object
Finally, associate your newly created Custom Object with other Encharge Objects by making a POST
request to api.encharge.io/v1/objects/{objectName}/{id}/associations/{associationId}/{targetId}
You can find the full request details here.
6. Update existing Custom Object
You can update data in existing Custom Object by making a PATCH
request to api.encharge.io/v1/objects/{objectName}/{id}
You can find the full request details here.