I'm getting a validation error updating custom fields on a contact

I’m trying to update custom fields with the REST API on a contact. When I make the request my response message is

"description"=>"Validation failed"

All of my custom fields have the same error on them:

  [{"field"=>"cf_payment_status", "message"=>"Unexpected/invalid field in request", "code"=>"invalid_field"}]

I’m not sure what the invalid field refers to. All of my custom fields are created in FreshChat and FreshDesk. Is there a specific structure to the request Params that I need to follow? There isn’t any documentation on updating custom_fields.

Here is a sample of my params:

 :cf_team_name=>"My Demo Team",

I’ve also tried nesting the params under a custon_fields key, but this still results in the invalid field validation error.

I’ve discovered what is wrong, and as I mentioned before this could have been avoided if there were documentation on how to update custom fields as it is not very intutive.

You need to define your custom fields without the “cf_” prefix.

  "your_custom_field_name_here"=>"some value",

This should help if anyone else is looking to update custom fields and getting an invalid field error.

PS: Keep in mind that date fields must follow the YYYY-MM-DD format.

1 Like