Setting Contact column to Placeholder using the API

hiker360
hiker360 ✭✭✭
edited 04/02/24 in API & Developers

I am programmatically updating a sheet using the SmartSheets API. I need to set a column that is a CONTACT type to a Resource Manager placeholder. When I do, I get the error message "The value for cell in column 6143599851818884, did not conform to the strict requirements for type CONTACT." Typically a contact can be set using the email address. However placeholders do not have email addresses so I attempt to set the placeholder text.

As an FYI, the field I'm trying to set is the Assigned To which is used in the RM integration.

When I look at the raw data for an existing value containing a placeholder it looks like

{

          "columnId": 6143599851818884,

          "value": ".NET Placeholder"

   }

Where as a typical user looks like

{

          "columnId": 6143599851818884,

          "value": "joshua.user@company.com",

          "displayValue": "Josh User"

        },


Using the APIs, how can I set the column value to the placeholder text?

Answers

  • Leibel S
    Leibel S ✭✭✭✭✭✭

    Try adding the overrideValidation = true in the query parameters, and within the cell object add strict = false

  • hiker360
    hiker360 ✭✭✭

    Good idea. Unfortunately still didn't work. Still get the error: The value for cell in column 6143599851818884, did not conform to the strict requirements for type CONTACT. Smartsheet support said that what I wanted to do was not supported.

  • Erin Horiuchi Green
    Erin Horiuchi Green ✭✭✭✭✭
    edited 05/31/24

    @hiker360 I did the below workaround using API python. THe Contact List was just too complex and not flexible for me to work with.

    Column A is my picklist and column B is a cross-sheet reference to the directory to capture email. As new records are registered in the sheet directly or via a form, I have automation in place to send update emails as specific information is updated or nearing a deadline.

    First, I get the Column ID info.

    import smartsheet

    smartsheet_client = smartsheet.Smartsheet('INSERT TOKEN')

    action = smartsheet_client.Sheets.get_columns(SHEET ID, )

    columns = action.data

    for col in columns:
            print(col.title)
            print(col.id)

    Then, I update Column A to a picklist with options.

    import smartsheet

    smartsheet_client = smartsheet.Smartsheet('INSERT TOKEN')

    column_spec = smartsheet.models.Column({
        'type': 'PICKLIST',
        'Options': [ 
          "INSERT NAME 1",
            "INSERT NAME 2",
            "INSERT NAME 3",
            "INSERT NAME #"
        ]
    })

    response = smartsheet_client.Sheets.update_column( SHEETID, COLUMNID, column_spec)
    updated_column = response.result

    So far, I have not hit a ceiling as my records < 1K.

    Erin Horiuchi Green, MBA, LSSYB, PSMI
    Process Manager
    Syneos Health

    Please kindly like ❤️, upvote ⬆️ and/or mark ✅ any of my contributions that have provided value.

    Core App and Project Managment Certified 🚀