Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Deleting a custom field value using _delete

45 views
Skip to first unread message

Alan Hart

unread,
Dec 20, 2018, 7:31:49 AM12/20/18
to Capsule API

I thought I would document how this works (as the documentation is vague), and ask for an enhancement.


To delete a custom field from an opportunity or party, you need to update the entity by including this within it:


"fields": [
  {
    "_delete": true,
    "definition": { "id": 1 }
  }
]



The definition number is the id of the field you want to delete.

Enhancement request:

A common requirement is, where you have been given a blank value for a custom field by your customer, you actually want to delete the custom field from that entity to ensure that it's no longer stored.

But if you ask for the custom field to be deleted and in fact that custom field was not currently set for that entity, you get an error. This is rather overly fussy. It forces you to load all the fields, check in a rather laborious way whether the field was there, and delete fields only where they are present. In my view, deleting a custom field for an entity should not be an error unless the field id is not a valid one for that entity type.

Ben Dale

unread,
Dec 20, 2018, 9:36:11 AM12/20/18
to Capsule API
Hi Alan,

Thanks for your comments and suggestions regarding deleting fields from entities. We can certainly improve the documentation around this area and I'll raise a request for this.

Regarding your enhancement request, it's unlikely that we're going to change this behaviour. If you imagine custom fields set up in the settings screen as "blueprints" and the custom fields actually set on a party as an "implementation" it might make a bit more sense why it works the way it does. An "implementation" of the custom field is either present on an entity or not. I will share your comments with the rest of the team though!

Thanks,

Ben
Reply all
Reply to author
Forward
0 new messages