Get notified when a monday.com board item status has not been updated to Done by a certain due date.


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 that periodically checks if items in a board meet a specific condition (status=Done by a certain due date), and if not, then send a notification. 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

TypeScriptitemsWithMatchedDate
Scheduled

README


๐Ÿ“‹ Overview

This template demonstrates how to build an automation in monday.com that periodically checks if items in a board meet a specific condition (status=Done by a certain due date), and if not, then send a notification.

๐Ÿ–Š๏ธ Setup

Follow these steps to configure the template with your board:

  1. Open the Send notification when items are due and status is not set as Done template.
  2. Click Create a Workspace on the top right corner of the screen.
  3. Review the Workspace name, Description and Add to a team fields.
    You can change these if needed.
  4. Click Create.
  5. On the left side of the screen, under API Connections, select Complete API Connection Setup.
  6. Select your Monday.com connector in the Uses connector field.
  7. Click Save.
  8. On the left side of the screen under Scheduled Triggers, select Complete scheduled trigger setup.
  9. In the CRON Expression field, enter how often you want the template to run.
  10. Click Save.
  11. Navigate to Parameters and and edit the following parameters:
    • DATES_LIST - Add specific dates in yyyy-mm-dd format to check for (optional).
    • USE_DATE_TODAY - Use current date to check for, default is set to true.
    • NUMBER_OF_DAYS_FROM_CURRENT_DATE - Set the number of days to check for from current date (optional).
    • BOARD_ID - The board ID to get items from.
    • DATE_COLUMN_ID - The ID of the Date column value to check.
    • STATUS_COLUMN - The ID of the Status column.
    • OWNER_COLUMN - The ID of the Owner column.
  12. Click Save Script at the top left of the scripting area.

๐Ÿš€ How to Use

At 9 AM daily, the script runs to check for items on the selected board that have not been completed by the date(s) entered into the script.

The owners of these items are notified in-app and by email with reminders to prioritise these items. Additionally, a log message is printed that notifications were sent for affected items.

The script checks for items where the dates in the Completion column match the following dates added into the DATES const (todays date, the date 3 days from the current date and another date of 29/05/2024):

Item

If Items are not yet completed on selected dates, then a notification is sent:

Notification

To manually test the script, follow these steps to trigger the script:

  1. Click Trigger Script Manually at the top left of the scripting area of the ItemsWithMatchedDate script.
  2. Monitor the output console at the bottom of the screen. The green tick indicates the script executed successfully.
  3. Check for your notification.

๐Ÿ–Š๏ธ How to modify the script

The script could be modified to send a notification to a Slack channel. The text constant in the script can be updated to send a more tailored message in the notification.

API Connections


TypeScriptitemsWithMatchedDate

import Monday from "./api/monday";
import { ItemReturnType } from "@managed-api/monday-core/definitions/item";

const COMPARATOR = "EXACT";
const PERSONS = "persons_and_teams";

export default async function (event: any, context: Context): Promise<void> {
  const { DATES_LIST, USE_DATE_TODAY, NUMBER_OF_DAYS_FROM_CURRENT_DATE, BOARD_ID, DATE_COLUMN, STATUS_COLUMN, OWNER_COLUMN, STATUS } = context.environment.vars;

  // get a list of all dates to check for
  const dates = getAllDates(DATES_LIST, USE_DATE_TODAY, NUMBER_OF_DAYS_FROM_CURRENT_DATE);

  // if no dates provided from environment variables
  if (!dates.length) {
    console.log("Script will terminate as no dates provided...");
    return;
  }

  // Compare value of EXACT date matches in string format
  const datesToCompare = `${COMPARATOR} ${dates.join(` ${COMPARATOR} `)}`.split(" ");

  const returnMultipleFilteredDateItems = await Monday.Board.getBoards({
    args: {
      ids: [BOARD_ID],
    },
    fields: {
      items_page: {
        args: {
          query_params: {
            rules: [
              {
                column_id: DATE_COLUMN,
                compare_value: datesToCompare,
                operator: 'any_of'
              }
            ]
          }
        },
        fields: {
          items: {
            fields: {
              id: true,
              name: true,
              column_values: {
                fragments: {
                  StatusValue: {
                    text: true
                  },
                  PeopleValue: {
                    [PERSONS]: {
                      fields:{
                        id: true,
                      }
                    }
                  }
                },
                fields: {
                  id: true,
                }
              }
            }
          }
        }
      }
    }
  })

  const { items } = returnMultipleFilteredDateItems.data.boards[0].items_page;

  // Process returned items with just required item properties
  const processedItems = items.map((item: ItemReturnType) => {
      const { column_values, name, id } = item;
  
      const status = column_values.find(({ id }) => id === STATUS_COLUMN).text;
      const owners: string[] = column_values.find(({ id }) => id === OWNER_COLUMN)[PERSONS].map(({ id }) => id);
      
      return { name, id, status, owners };
  })

  // Send notification if item status if not Done and has owners
  for (const processedItem of processedItems) {
    const { status, owners, name, id } = processedItem;

    if (status !== STATUS && owners.length) {
      const text = `Hi, the ${name} item has not yet been completed/ completion date is approaching, please prioritise this item.`;

      console.log(`Notification sent for ${name} that item needs to be a priority`);

      for (const owner of owners) {
        await Monday.Notification.createNotification({
            args: {
                user_id: owner,
                target_id: id,
                target_type: 'Project',
                text
            },
            fields: {
                text: true
            }
        });
      }
    }
  }

}

function getAllDates (dates: string[], useToday: boolean, numberOfDays: number) {
  let arr = dates;

  if (useToday) arr = [...arr, getDateToday()];
  if (numberOfDays !== undefined) arr = [...arr, getDateInSetNumberOfDays(numberOfDays)];

  return arr;
}

function getDateToday () {
    const currentDate = new Date();

    // Return formatted date as yyyy-mm-dd
    return currentDate.toISOString().split('T')[0];
}

function getDateInSetNumberOfDays (days: number) {
  const currentDate = new Date();
  currentDate.setDate(currentDate.getDate() + days); // Add number of days to the current date
  
  // Return formatted date as yyyy-mm-dd
  return currentDate.toISOString().split('T')[0];
}
Documentation ยท Support ยท Suggestions & feature requests