Passing Null Custom Field Data to New Ticket via POST

2 Comments

  • Sebastiaan (Sparkly ⭐)
    Community Moderator

    Hey Dean,

    I'm not sure if it's the formatting, or that the `null` values are actually not in your payload. Maybe you could try this:

        "custom_fields": [
            {
              "id": 4415661978388,
              "value": 401187672072
            },
            {
              "id": 4415682949268, 
              "value": 246214
            },
            {
              "id": 360041327151, 
            "value": null
            },
            {
              "id": 360041372052, 
              "value": ""
            },
            {
              "id": 360041372372, 
            "value": null
            },
            {
              "id": 4417038927636, 
              "value": ""
            }
          ],

    Or if that fails, try empty Strings like the other fields? Haven't tested it yet, but I never had this issue, so I guess it's one or the other 😅

    0
  • Dean Kongslie

    Sebastiaan (Sparkly ⭐) I figured it out. Since this JSON is getting fired from a ZD trigger I cannot know at the time of making the trigger if the data will be null or not. I was running into a problem on integer values specifically.

    I naturally did not put quotes around the {{ticket.ticket_field_id}}, but this was causing a problem when null values would populate. When I put quotes around it, then it did work. So the example would look like:

    "custom_fields": [
            {
              "id": 4415661978388,
            "value": "{{ticket.ticket_field_id}}"
            }
    ]
    0

Please sign in to leave a comment.

Powered by Zendesk