Template Content
About the template
About ScriptRunner Connect
What is ScriptRunner Connect?
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.
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.
Follow these steps to configure the template with your board:
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.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):
If Items are not yet completed on selected dates, then a notification is sent:
To manually test the script, follow these steps to trigger 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.
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];
}