Sync monday.com board item status and date columns across boards


Get Started

Not the template you're looking for? Browse more.

About the template


This template demonstrates how to build an automation in monday.com board to sync item status and date column updates across boards. Get started to learn more.

About ScriptRunner Connect


What is ScriptRunner Connect?

ScriptRunner Connect is an AI assisted code-first (JavaScript/TypeScript) integration platform (iPaaS) for building complex integrations and automations.

Can I try it out for free?

Yes. ScriptRunner Connect comes with a forever free tier.

Can I customize the integration logic?

Absolutely. The main value proposition of ScriptRunner Connect is that you'll get full access to the code that is powering the integration, which means you can make any changes to the the integration logic yourself.

Can I change the integration to communicate with additional apps?

Yes. Since ScriptRunner Connect specializes in enabling complex integrations, you can easily change the integration logic to connect to as many additional apps as you need, no limitations.

What if I don't feel comfortable making changes to the code?

First you can try out our AI assistant which can help you understand what the code does, and also help you make changes to the code. Alternatively you can hire our professionals to make the changes you need or build new integrations from scratch.

Do I have to host it myself?

No. ScriptRunner Connect is a fully managed SaaS (Software-as-a-Service) product.

What about security?

ScriptRunner Connect is ISO 27001 and SOC 2 certified. Learn more about our security.

Template Content


README

Scripts

TypeScriptOnMondayWhenAStatusChanges
When a status changes

README


đź“‹ Overview

This template demonstrates how to build an automation in monday.com board to sync item status and date column updates across boards.

🖊️ Setup

In order to configure this script to run against your selected board, complete the following steps below:

  • Configure the API Connection providing a monday.com connection that gives you access to the board you'd like to run this script against.
  • Configure an Event Listener for When a status changes by creating a connector for monday.com, or use an existing one to execute script when a status changes.
  • Navigate to Parameters and edit the following parameters (you can find the required ids here):
    • TARGET_BOARD_ID - The target Board id to update the item status.
    • TARGET_DATE_COLUMN_ID - The id of the target Date column to update.
    • TARGET_STATUS_COLUMN_ID - The id of the target Status column to update.

🚀 How to Use

On the Board when an item’s status is updated, which also has an item of the same name on the target board. The listener setup earlier will trigger and update the values in Updated Date and Status columns for that item on the target board.

An item on a board with current Status to Not Started:

Current board

The item on the target board with empty Status and Updated Date field values:

Current target board

The item on the board with the Status updated to Working on it:

Updated board status

The item on the target board with updated Status and Updated Date field values:

Updated target board

🖊️ How to modify the script

This template shows how to update another board’s items by listening to a specific Monday event. The script could be modified to also update an item’s other column values on the target board to match the same value on the board.

API Connections


TypeScriptOnMondayWhenAStatusChanges

import { UpdateStatusEvent } from "@sr-connect/monday/events";
import Monday from "./api/monday";

/**
 * Entry point to when a "status column changes" event is triggered
 *
 * @param event Object that holds When status column changes event data
 * @param context Object that holds function invocation context data
 */
export default async function (event: UpdateStatusEvent, context: Context): Promise<void> {
    if (context.triggerType === 'MANUAL') {
        console.error('This script is designed to be triggered externally or manually from the Event Listener. Please consider using Event Listener Test Event Payload if you need to trigger this script manually.');
        return;
    }

    const { TARGET_BOARD_ID, TARGET_DATE_COLUMN_ID, TARGET_STATUS_COLUMN_ID } = context.environment.vars;

    // Extract parameters from the event
    const { pulseName, value } = event.event;

    // Check if pulseName is present in the event
    if (!pulseName) {
        throw Error("Pulse Name not present in the event");
    }

    // Check if value is present in the event
    if (!value) {
        throw Error("Value is not present in the event");
    }

    const updatedLabel = value.label.text;

    // Get items from the target board
    const itemsBoardTarget = await Monday.ItemsPage.getItemsPageByColumnValues({
        args: {
            board_id: TARGET_BOARD_ID,
            columns: [{ column_id: "name", column_values: [pulseName] }] // Filter items that match this condition
        },
        fields: {
            items: {
                fields: {
                    id: true
                }
            }
        }
    });

    // Get the id of the item in the target board with the same name
    const itemTargetId = itemsBoardTarget.data.items_page_by_column_values.items[0].id;
    
    // Check if the target item ID is found
    if (!itemTargetId) {
        throw Error(`There is no item with the name ${pulseName} in target board`);
    }

    // Update the status and updated date columns in the target board
    await Monday.Column.changeMultipleColumnValues({
        args: {
            board_id: TARGET_BOARD_ID,
            item_id: +itemTargetId,
            column_values: {
                [TARGET_STATUS_COLUMN_ID]: { label: updatedLabel },
                [TARGET_DATE_COLUMN_ID]: { date: getCurrentDate() }
            }
        },
        fields: {
            id: true
        }
    });
}

const getCurrentDate = (): string => {
    const currentDate = new Date();

    // Return formatted date
    return currentDate.toISOString().split('T')[0];
}
Documentation · Support · Suggestions & feature requests