Custom Field Values
- Retrieving custom field values
- Custom Field Value visibility
- Submitting a custom field value
- Updating custom field values
- Removing custom field values
Custom field values are managed through contact records as each custom field value belongs to a contact.
To create the custom fields themselves, please refer to the Custom Fields documentation.
The following fields relate to the Custom Field Values endpoint.
Field | Limits | Required? | Writeable? |
---|---|---|---|
id | Yes | No | |
The id of the custom field | |||
value | Yes | Yes | |
The value for this custom field and this user | |||
name | 255 characters | No | No |
The name of the custom field | |||
data_type | One of: Text, Number, Data, and Dollar Amt | No | No |
The type of data this field & value represent | |||
user_id | Some integer value | No | No |
The user who added this custom field |
Retrieving Custom Field Values
GET https://api-v2.liondesk.com//contacts/10
headers: {
Authorization: "Bearer [access token]",
Content-Type: "application/json"
}
Custom Field Values are returned along with the contact:{
This list of custom fields represents all the available custom fields available on a contact, along with the associated values, if they exist.
Note that the additional fields (data_type, name, user_id, rank
) are simply listed for convenience. They belong to the custom fields themselves rather than the values, and cannot be modified with the contacts endpoint.
Visibility
Custom fields and their values are visible if:
- You added them yourself
- Your broker added them and your broker has chosen to share his custom fields with his sub-accounts.
Custom fields are not shared with assigned users or team mates.
Submission
Before submitting any values, corresponding custom fields must first exist.
Once custom fields exist on your account or your broker's account, you may retrieve a list of custom fields along with the contact you're interested in, as shown above under Retrieving Custom Fields.
Submit embedded custom field data to save values to the database:
POST https://api-v2.liondesk.com//contacts
headers: {
Authorization: "Bearer [access token]",
Content-Type: "application/json"
}data: {
first_name: "Corey",
last_name: "Sanford", custom_fields: [{
id: "147",
value: "Hansel and Gretel",
},
{
id: "148",
value: "2",
}]}
Note the following about the request above:
- Two custom field values will be saved to the database.
- The two fields (
id, value
) in the first object are all that's necessary to save a custom field value. - Any additional fields (
data_type, name, user_id, rank
) will be discarded. - See the custom fields docs for how to update the fields.
- The
id
field represents the custom field id, and is used along with the contact id to save the value to the custom field and contact. - PATCHing a contact with custom fields will have the same effect:
- Values are created if they didn't exist before
- Values are updated if they already existed
Updating Custom Field Values
You may update custom field values through a contact as well:
PATCH https://api-v2.liondesk.com//contacts/10
headers: {
Authorization: "Bearer [access token]",
Content-Type: "application/json"
}data: { custom_fields: [{
id: "147",
value: "Hansel, Gretel and Humpty Dumpty",
},
{
id: "148",
value: "3",
}]}
Deleting Custom Field Values
To delete custom field values, simply submit the custom field id along with a value that is: null, an empty string, or missing altogether. This will cause the custom field value to be deleted from the system.
PATCH https://api-v2.liondesk.com//contacts/10
headers: {
Authorization: "Bearer [access token]",
Content-Type: "application/json"
}data: { custom_fields: [
{
id: "147",
value: ""
},
{
id: "148",
value: null
},
{
id: "149"
}
]}