"autoNumberFormat" seems to be ignored

jarredcody
edited 10/04/24 in API & Developers

I am trying to add an AutoNumber column type to a sheet
It seems to work just fine

The issue I am having is the "autoNumberFormat" seems to be ignored.

I can go into the smartsheet.com and manually edit the prefix, and suffix, and starting number in the sheet and it works fine… but the API isn't applying this on column creation?

Any ideas why?

Side note: There used to be an autonumber column - but it was deleted prior. Seems this is where the new autonumber is starting at where the previous one left off with the same prefix and suffix.

I also tried doing this on a new sheet/project and same result ignored the autoNumberFormat

Returned:
New column added: {"data": [{"autoNumberFormat": {"fill": "0", "prefix": ", ", "suffix": ","}, "description": "This is an auto-number column", "id": 4895256532438916, "index": 0, "systemColumnType": "AUTO_NUMBER", "title": "AutoNumberTest", "type": "TEXT_NUMBER", "validation": false, "width": 200}], "message": "SUCCESS", "result": [{"autoNumberFormat": {"fill": "0", "prefix": ", ", "suffix": ","}, "description": "This is an auto-number column", "id": 4895256532438916, "index": 0, "systemColumnType": "AUTO_NUMBER", "title": "AutoNumberTest", "type": "TEXT_NUMBER", "validation": false, "width": 200}], "resultCode": 0, "version": 48}

As you can see the autoNumberFormat returned is not what I passed in the payload above

Tags:

Answers

  • SSFeatures
    SSFeatures ✭✭✭✭✭

    Hi @jarredcody,

    I noticed that in your first screenshot you set the column type using:

    systemColumnType: "AUTO_NUMBER"
    

    And in the second screenshot you set the column type using:

    type: "TEXT_NUMBER"systemColumnType: "AUTO_NUMBER"
    

    How about trying this instead:

    type: "AUTO_NUMBER"
    

    For example:

    new_column = smartsheet.models.Column({    "title": "Auto Number",    "type": "AUTO_NUMBER",    "autoNumberFormat": {        "prefix": "TEST-",        "startingNumber": 1    }})
    

    Let me know if this fixes the problem!

    SSFeatures - The browser extension that adds more features into SmartSheet.

    • Automatic sorting, sorting with filters, saving sort settings
    • Spell checking
    • Report PDF generator that supports grouped and summarized reports

  • @SSFeatures That did not work

    It has not problem creating the column - it is a "systemColumnType"
    it is not applying the autoNumberFormat

  • I tried to run as you suggested
    ({    "title": "Auto Number",    "type": "AUTO_NUMBER",    "autoNumberFormat": {        "prefix": "TEST-",        "startingNumber": 1    }})

    {"response": {"statusCode": 400, "reason": "Bad Request", "content": {"errorCode": 1012, "message": "Required object attribute(s) are missing from your request: {0}.", "refId": "c64a9418-416e-494f-b4bd-d71165c99b34"}}}
    New column added: {"result": {"code": 1012, "errorCode": 1012, "message": "Required object attribute(s) are missing from your request: {0}.", "name": "ApiError", "recommendation": "Do not retry without fixing the problem. ", "refId": "c64a9418-416e-494f-b4bd-d71165c99b34", "shouldRetry": false, "statusCode": 400}}