ERRATA: remote options columnType uses old string not modern enum still

With API 2023-10, the column types have changed to an enum, with changed values.

When you have a custom field for remote options, and the dependency is the “Column” of a trigger like “when column changes” it sends the following structure:

"dependencyData": {
                "boardId": 123324234,
                "columnId": {
                    "boardId": 123324234,
                    "columnId": "status",
                    "columnType": "color",
                    "invalid": false
                }
            }

(ignore that the field is called columnId - thats a side effect this field having been intended originally to use an action column field and not a trigger output column field. )

Note the “columnType” being sent is using the OLD string values, and not the modern enum.

I’ve written a preprocessor function for my parser (Zod) to solve this (it just takes in the original value and returns the modern value), but I’d say this is something that needs to get addressed, at least as documented errata.

Ideally we’d have the option to pick a “version” of the apps framework for an app/feature for the mode for this, which would also send the boardId as a string so it matches the API as well. Then we can get everything in the modern types.

Hi Cody,

Thank you for raising this behavior. I’ll go ahead and bring this up with our developers to make sure this is documented and addressed. Thanks!

Best,
Joseph

I haven’t verified but I would not be surprised if the Column Type field in an integration block behaves the same.

I had this issue too but with the timeline column returning timerange instead of the new timeline. This shows that it problem is across the various columns, that is they are still using the previous column types in the new api.

I’ve not experienced the API itself returning the old values in valid responses. However I have seen it use the old values in errors!

The payloads for integration blocks though, and remote options for custom fields still use the old values exclusively - which I suppose makes sense since those aren’t versioned at all.

For reference for anyone who hasn’t seen the chart:

The below TypeScript should assist anyone who needs to modernize old column type strings to the modern ColumnType enum. You can also use the ColumnType enum generally in your code, makes it easier to specify column types.

export enum ColumnType {
    /** Number items according to their order in the group/board */
    AutoNumber = "auto_number",
    /** Connect data from other boards */
    BoardRelation = "board_relation",
    /** Perform actions on items by clicking a button */
    Button = "button",
    /** Check off items and see what's done at a glance */
    Checkbox = "checkbox",
    /** Manage a design system using a color palette */
    ColorPicker = "color_picker",
    /** Choose a country */
    Country = "country",
    /** Add the item's creator and creation date automatically */
    CreationLog = "creation_log",
    /** Add dates like deadlines to ensure you never drop the ball */
    Date = "date",
    /** Set up dependencies between items in the board */
    Dependency = "dependency",
    /** Instantly add collaborative rich text editor */
    Doc = "doc",
    /** Create a dropdown list of options */
    Dropdown = "dropdown",
    /** Email team members and clients directly from your board */
    Email = "email",
    /** Add files & docs to your item */
    File = "file",
    /** Use functions to manipulate data across multiple columns */
    Formula = "formula",
    /** Add times to manage and schedule tasks, shifts and more */
    Hour = "hour",
    /** Integration is really cool... */
    Integration = "integration",
    /** Show all item's assignees */
    ItemAssignees = "item_assignees",
    /** Show a unique ID for each item */
    ItemId = "item_id",
    /** Add the person that last updated the item and the date */
    LastUpdated = "last_updated",
    /** Simply hyperlink to any website */
    Link = "link",
    /** Place multiple locations on a geographic map */
    Location = "location",
    /** Add large amounts of text without changing column width */
    LongText = "long_text",
    /** Show and edit columns' data from connected boards */
    Mirror = "mirror",
    /** Name is really cool... */
    Name = "name",
    /** Add revenue, costs, time estimations and more */
    Numbers = "numbers",
    /** Assign people to improve team work */
    People = "people",
    /** Call your contacts directly from monday.com */
    Phone = "phone",
    /** Show progress by combining status columns in a battery */
    Progress = "progress",
    /** Rate or rank anything visually */
    Rating = "rating",
    /** Get an instant overview of where things stand */
    Status = "status",
    /** Use the subtasks column to create another level of tasks */
    Subtasks = "subtasks",
    /** Add tags to categorize items across multiple boards */
    Tags = "tags",
    /** Assign a full team to an item  */
    Team = "team",
    /** Add textual information e.g. addresses, names or keywords */
    Text = "text",
    /** Easily track time spent on each item, group, and board */
    TimeTracking = "time_tracking",
    /** Visualize your item’s duration, with a start and end date */
    Timeline = "timeline",
    /** Unsupported column type */
    Unsupported = "unsupported",
    /** Vote on an item e.g. pick a new feature or a favorite lunch place */
    Vote = "vote",
    /** Select the week on which each item should be completed */
    Week = "week",
    /** Keep track of the time anywhere in the world */
    WorldClock = "world_clock",
}

export type ColumnTypeUnion = `${ColumnType}`; //a type union from enum ColumnType

export function modernizeColumnTypes(columnType: string | ColumnType): ColumnType {
    /** ColumnType is a string enum, so will pass as a string*/
    if (typeof columnType !== "string") {
        throw new Error("columnType must be a string");
    }

   /** There are many ways to do this. Maps, objects, switch statements. Switch was the shortest though not least verbose path. */
    switch (columnType) {
        case "autonumber": {
            return ColumnType.AutoNumber;
        }
        case "boolean": {
            return ColumnType.Checkbox;
        }
        case "color-picker": {
            return ColumnType.ColorPicker;
        }
        case "board-relation": {
            return ColumnType.BoardRelation;
        }
        case "dependent_on": {
            return ColumnType.Dependency;
        }
        case "files": {
            return ColumnType.File;
        }
        case "pulse-log": {
            return ColumnType.CreationLog;
        }
        case "pulse-id": {
            return ColumnType.ItemId;
        }
        case "pulse-updated": {
            return ColumnType.LastUpdated;
        }
        case "long-text": {
            return ColumnType.LongText;
        }
        case "lookup": {
            return ColumnType.Mirror;
        }
        case "monday_doc": {
            return ColumnType.Doc;
        }
        case "numeric": {
            return ColumnType.Numbers;
        }
        case "multiple-person": {
            return ColumnType.People;
        }
        case "columns-battery": {
            return ColumnType.Progress;
        }
        case "color": {
            return ColumnType.Status;
        }
        case "tag": {
            return ColumnType.Tags;
        }
        case "timerange": {
            return ColumnType.Timeline;
        }
        case "duration": {
            return ColumnType.TimeTracking;
        }
        case "votes": {
            return ColumnType.Vote;
        }
        case "timezone": {
            return ColumnType.WorldClock;
        }
        case "team": {
            return ColumnType.Team;
        }
        case "person": {
            return ColumnType.Unsupported;
        }
        default: {
            return columnType as ColumnType;
        }
    }
}

1 Like