How do I "uncheck" a multi_choice field with the PUT/update customer API?

ChrisSteeleChrisSteele Member Posts: 1
edited July 2019 in Development

I have a custom field which has 12 options (months of the year) that can be checked or unchecked as needed. I can update a field to turn it on, but I can't figure out how to turn it off. The value seems to have no effect. Here's what I'm sending in the PUT body to turn on a month. How would I turn this month back off?

{
    "CustomFieldValues": {
        "CustomFieldValue": [{
            "customFieldID": "13",
            "value": {
                "customFieldChoiceID": "11",
                "value": ""
            }
        }]
    }
}

The api I'm using is a PUT with https://api.lightspeedapp.com/API/Account/${accountId}/Customer/$[custId}.json

Tags:

3 comments

  • Adrian SamuelAdrian Samuel Moderator, Lightspeed Staff Posts: 654 moderator

    Hey @ChrisSteele,

    A boolean set to true would check the box and a boolean set to false would uncheck the checkbox.

    Here's a similar payload I've just tested in my own sandbox:

    {
    
      "CustomFieldValues": {
        "CustomFieldValue": [{
          "customFieldID": "{{id}}",
          "value": false    
        }]
      }
    
    }
    


    I hope this helps!

    Adrian Samuel

    Software Developer

    Lightspeed HQ

  • david_dotdevdavid_dotdev Member Posts: 5

    Hi Samuel, I've tried this but it doesn't seem to work. Also, I don't really get how does that payload specify which option to specifically uncheck?

  • david_dotdevdavid_dotdev Member Posts: 5
    edited January 18

    Just figured out that setting a field called "delete" to "true" will actually delete the option.

    {
    
      "CustomFieldValues": {
        "CustomFieldValue": [{
          "customFieldValueID": "123",
          "deleted": "true"  
        }]
      }
    
    }
    


Sign In or Register to comment.