Validation error when setting custom field | The place for Zendesk users to come together and share
Skip to main content
Mark32
December 6, 2024
Question

Validation error when setting custom field

  • December 6, 2024
  • 12 replies
  • 68 views

I'm trying to update a custom field value via the API. I'm using a PUT request to /api/v2/tickets/<ticketID>.json I'm getting a validation error as follows:

{
  "error": "RecordInvalid",
  "description": "Record validation errors",
  "details": {
    "base": [
      {
        "description": "Incident vs. Service Request: needed",
        "error": null,
        "ticket_field_id": 21621964218653,
        "ticket_field_type": "FieldTagger"
      }
    ]
  }
}

 

The “Incident vs. Service Request” field is not the field I'm updating. I assume there some is configuration that is making this field required when updating a ticket, although I can't figure out what that config might be? The field has “Required to solve a ticket” enabled, but I'm not trying to solve a ticket, and there are other fields with this setting which don't cause the same problem. Can anyone help me out?

 

Thanks.

 

12 replies

Mark32
Mark32Author
July 2, 2025

@erica26 thanks, but I'm not sure you've understood my actual issue. Let me clarify.

1. Agent opens a ticket

 

2. Sidebar app loads immediately

 

3. Sidebar app queries an external API with the requester's email address and receives some extra data about the requester. We now want to save this straight back to the ticket in custom fields.

 

4. Sidebar app tries to save this extra data back to custom fields ( i.e. by sending a PUT request to /api/v2/tickets/<ticketid>.json with the body like this


{
  "ticket": {
    "custom_fields": [
      {
        "id": "27609430851869",
        "value": 661
      },
      {
        "id": "27609398553885",
        "value": "Some data"
      },
      ... etc
    ]
  }
}

 

5. Sidebar app receives 422 Unprocessable Content error with the following body:

{
   "error": "RecordInvalid",
   "description": "Record validation errors",
   "details": {
       "base": [
           {
               "description": "25 - Incident Vs Query : needed",
               "error": null,
               "ticket_field_id": 27690247974045,
               "ticket_field_type": "FieldTagger"
           }
       ]
   }
}

 

All this happens in the first few seconds after opening a ticket. So it's impossible to populate any custom fields on a ticket until the ticket has been submitted by the agent with all required fields completed, even if those custom fields are not required themselves.   

Erica
Employee
July 7, 2025
Hi Mark, 
 
So you would have to set the conditions of that custom ticket field to exceed the needs/priority of your other required fields. 
 
The Update Ticket API is strict on following any ticket rules. Basically when a request is made to the update ticket API all of the rules set for a ticket are run and if something is missing it won't allow the update to take place. The difference between a ticket field being checked as required and a trigger for a ticket field is that the trigger is looking for very specific conditions to be met. 
 
This is what I would do: let's say you have 4 required ticket fields (A, B, C, D). Two of those custom ticket fields (C & D) are what you want to populate at ticket creation. However, because A & B are also required, the update won't go through. 
 
What you'll do then is for A & B you'll uncheck Required to solve ticket for both of those. Then you'll create a trigger for A & B that specifically prevents the ticket from being closed without those fields being present. 
 
That way you can successfully pass data to the Update Ticket API to ticket fields C & D at ticket creation. 
 
So if you set a check to see if the other required fields are present specifically when a ticket is trying to be closed then the only rule for those fields that Update ticket API will stop for is when the ticket status is being set to closed. It should allow you to update the ticket at creation for those custom fields your passing data to.