How to automatically set a due date when a work item is created
Last updated: July 3, 2026
This guide shows you how to set a due date on a work item automatically at the moment it is created.
Before you begin
Make sure you have access to:
Create the script
Go to Workspace Settings → Plane Runner → Scripts.
Click New Script.
Give your script a name.
Replace the editor contents with the script below and click Save.
The following script sets the due date to 7 days from the date the work item is created. To use a different offset, change the value of daysUntilDue before saving. For example: 1 = tomorrow, 14 = two weeks, 30 = one month.
export async function main(input: AutomationEventInput, variables: Record<string, string>) {
const { event } = input;
const workItemId = event.payload.data.id;
const projectId = event.project_id;
// ✏️ Change this number to control how far ahead the due date is set.
// 1 = tomorrow, 7 = one week, 14 = two weeks, 30 = one month
const daysUntilDue = 7;
const dueDate = new Date();
dueDate.setDate(dueDate.getDate() + daysUntilDue);
const dueDateStr = dueDate.toISOString().split("T")[0];
await Plane.workItems.update(workspaceSlug, projectId, workItemId, {
target_date: dueDateStr,
});
return { success: true, target_date_set: dueDateStr };
}Set up the automation
Go to Project Settings → Automations and click Create automation.
Click Add trigger and select Work item created.
Go to the Action tab, click Add action, select Run script, and choose the script you created.
Click Enable.
Every new work item created in this project will now get a due date set to 7 days from today.
For recurring work items
If you use recurring work items and want each new instance to get a due date automatically, add a label such as recurring to the recurring work item template.
Then add a condition to the automation:
Condition: Label IS recurring
This ensures the automation runs only on work items created from that template. Work items without the label are not affected.
To set up a recurring work item template, go to Project Settings → Recurring work items.
Verify it is working
Create a new work item in your project.
Open it and confirm a due date is showing.
If no due date appears, go to Project Settings → Automations, open your automation, and check the Activity tab to see if a run was logged and whether it succeeded.
Troubleshooting
Issue | What to check |
|---|---|
Automation is not firing | Confirm the automation is enabled and the trigger is set to Work item created |
Script ran but the date is wrong | Edit |
Recurring instances are not getting a due date | Confirm the label in the automation condition matches the label on the recurring work item template exactly, including capitalisation |