Multi-picklist using a list of element "errorCode": 5536

I'm trying to implement a multi_picklist with a list of elements, the following code works with one element but fail with a second one, so I think the structure is good, but the format of my list maybe wrong or I'm missing something


def listToString(s):

str1 = ""

    for e in s:

        str1 += e

        print(str1)

        return str1

new_cell_add = smart.models.Cell()

new_row_add.cells.append({'column_id': ######, 'object_value': {'objectType': 'MULTI_PICKLIST', 'values': listToString(my list)}, 'strict': True})

I'm getting the error:

{"result": {"code": 5536, "errorCode": 5536, "message": "The value \"com.navigo.smartsheet.rest.helper.sheet.cell.model.MultiPicklist@24f40bb\" could not be saved in column 

Any ideas ?

Best Answer

  • Alex Argumedo
    Alex Argumedo ✭✭✭✭✭
    Answer ✓

    I found the answer to this question,

    1. Call the sheet as level two and make sure the object details are included in the get
    2. The MULTI-PICK column it cannot be locked, or you will get the same error
    3. The list of objects has to be added to the element, it cannot be a list and then convert it as the API doesn't like it
    4. my loop in the function displayed above had an extra indentation in the return line

    I hope this help others,

Answers

  • Alex Argumedo
    Alex Argumedo ✭✭✭✭✭
    Answer ✓

    I found the answer to this question,

    1. Call the sheet as level two and make sure the object details are included in the get
    2. The MULTI-PICK column it cannot be locked, or you will get the same error
    3. The list of objects has to be added to the element, it cannot be a list and then convert it as the API doesn't like it
    4. my loop in the function displayed above had an extra indentation in the return line

    I hope this help others,

  • Hi Alex,

    I am having the same issue that you reported. I can insert a new row with a Multi-Picklist column when I only specify a single value.

    I am using the HTTP Action in Microsoft Power Automate. Here is the relevant portion of the Request Body:

     {

        "columnId": "3509176034977668",

        "objectValue": {

         "objectType": "MULTI_PICKLIST",

         "values": [

          "Reduce Risks",

          "CAPA Request",

          "Other"

         ]

        }

       },

    You mentioned in your answer for #1 to include a query parameter for "level" and to make sure object details are include.

    So in the URI I have the following:

    https://api.smartsheet.com/2.0/sheets/8475180289812356/rows?level=2&include=objectValue

    Method is a POST.

    Unfortunately as mentioned I get the same error that you got unless I only include a single value in the values array.

  • Alex Argumedo
    Alex Argumedo ✭✭✭✭✭

    #I created an small function to create the object to post as the multivalue:

    def objectList(s):

        str2 = []

        for o in s:

            str2.append(o)

        return str2

    detailed_lst = ('list','of','objects')

    new_list =objectList(detailed_lst)

    # then I used this syntax:

    new_row_add.cells.append({'column_id': newrow_id, 'object_value': {'objectType': 'MULTI_PICKLIST', 'values': new_list}, 'strict': True})

    # my issue was how the list was created, and this was the way I was able to do it, also my script is reused for #multiple purposes (that's why the multiple steps to get the final list)