Recent searches


No recent searches

Create new ticket with defined custom_field_option



Posted Apr 12, 2023

Hello,

I'm looking to create through API a new ticket with a specific custom_field_option.

This example works fine with custom field :

{
  "ticket": {
    "subject": "New ticket",
    "custom_fields": [{  "id": 6546465464, "value": "test"   }]  
  }
}

But I can't figured it out with dropdown lists (custom_field_option).

Is there anything special to know ?


0

3

3 comments

Hi,

Yes, I'm already using the tag not the title.

Is the syntax the same between "custom_fields" and "custom_field_option" ?

Do I only have to specify the dropdown list ID and it's value ?

I can't find any example.

0


image avatar

Rafael Santos

User Group Leader

For the ticket's custom_fields object, you'll want to provide the custom_field's id and its custom_field_option's value.

For a given Ticket custom field example:

{
"ticket_fied": {
"id": 123456,
    "type": "tagger",
  "title": "Field example",
"custom_field_options": [
      {
      "id": 7777,
      "name": "Foo Bar",
      "raw_name": "Foo Bar",
      "value": "foo_bar",
        "default": false
      },
      {
      "id": 9999,
      "name": "Foo Biz",
      "raw_name": "Foo Biz",
      "value": "foo_biz",
        "default": false
    }
]
}
}

The ticket would have this if you want to set Field example to Foo Biz

{
"ticket": {
"custom_fields": [
{
"id": 123456,
"value": "foo_biz"
}
]
}
}

EDIT: Documentation > Creating and updating tickets > Setting custom field values

0


Thanks for your detailed answer.

My syntax was right but it seems that our CRM integration (from 3CX phone system) wants to create an new option and not just setting it as the logs says :

2023/04/13 16:47:48.805|2445|0041|Erro|CRM: Exception during call reporting: System.ArgumentException: Can not add property custom_fields to Newtonsoft.Json.Linq.JObject. Property with the same name already exists on object.

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post