Well, I’m going to try to be proactive (or potentially annoying) in the hope that this post doesn’t go unnoticed for months like some. @Elias_Gomez_Sainz, @W_Vann_Hall, @Justin_Barrett– you are community leaders who I have seen post about similar queries. Do any of you have any guidance you could offer on my described workflow issue re: generating different sets of tasks for different projects? Thank you in advance :pray:
Well, I’m going to try to be proactive (or potentially annoying) in the hope that this post doesn’t go unnoticed for months like some. @Elias_Gomez_Sainz, @W_Vann_Hall, @Justin_Barrett– you are community leaders who I have seen post about similar queries. Do any of you have any guidance you could offer on my described workflow issue re: generating different sets of tasks for different projects? Thank you in advance :pray:
Tagging @JonathanBowen, the author of the original script you linked above. He would be the ideal candidate for this task.
Tagging @JonathanBowen, the author of the original script you linked above. He would be the ideal candidate for this task.
Thanks @Justin_Barrett :slightly_smiling_face:
@Jessica_Pena - will post some thoughts on this later today
Thanks @Justin_Barrett :slightly_smiling_face:
@Jessica_Pena - will post some thoughts on this later today
@Jessica_Pena - we just need to extend the model and the script to accommodate different types of project templates. There’s probably a few ways to do this, but here’s my thoughts:
Base - pretty much the same as before, but we’ve got an additional “project templates” table:

Project Templates and Task Templates are a linked pair of tables that define the project type/template and the tasks for that type:


Now what we want to do in our script is pick a project that we want to set up and the template that we want to apply to it. So our script is:
let projectsT = base.getTable('Projects');
let tasksT = base.getTable('Tasks');
let projectTemplateT = base.getTable('Project Templates');
let project = await input.recordAsync('Pick a project', projectsT);
let projectTemplate = await input.recordAsync('Pick a project template', projectTemplateT);
let projectTasks = [];
if (projectTemplate) {
output.text(`Creating tasks for ${project.getCellValueAsString('Name')} using template ${projectTemplate.getCellValueAsString('Name')} ... please wait`);
for (let task of projectTemplate.getCellValue('Tasks')) {
projectTasks.push(
{
fields: {
'Task': task.name,
'Project': [ {id: project.id} ]
}
}
)
}
}
while (projectTasks.length > 0) {
await tasksT.createRecordsAsync(projectTasks.slice(0, 50));
projectTasks = projectTasks.slice(50);
}
The script flow is:
- Pick a project
- Pick the project type/template you want to apply
- Get the tasks for this template
-
push
these tasks into an array which suitable for the Tasks table
- create the records in the tasks table based on the data in the array
The create
block creates 50 task records in one go (if there are that many) - more on this here
@Jessica_Pena - we just need to extend the model and the script to accommodate different types of project templates. There’s probably a few ways to do this, but here’s my thoughts:
Base - pretty much the same as before, but we’ve got an additional “project templates” table:

Project Templates and Task Templates are a linked pair of tables that define the project type/template and the tasks for that type:


Now what we want to do in our script is pick a project that we want to set up and the template that we want to apply to it. So our script is:
let projectsT = base.getTable('Projects');
let tasksT = base.getTable('Tasks');
let projectTemplateT = base.getTable('Project Templates');
let project = await input.recordAsync('Pick a project', projectsT);
let projectTemplate = await input.recordAsync('Pick a project template', projectTemplateT);
let projectTasks = [];
if (projectTemplate) {
output.text(`Creating tasks for ${project.getCellValueAsString('Name')} using template ${projectTemplate.getCellValueAsString('Name')} ... please wait`);
for (let task of projectTemplate.getCellValue('Tasks')) {
projectTasks.push(
{
fields: {
'Task': task.name,
'Project': [ {id: project.id} ]
}
}
)
}
}
while (projectTasks.length > 0) {
await tasksT.createRecordsAsync(projectTasks.slice(0, 50));
projectTasks = projectTasks.slice(50);
}
The script flow is:
- Pick a project
- Pick the project type/template you want to apply
- Get the tasks for this template
-
push
these tasks into an array which suitable for the Tasks table
- create the records in the tasks table based on the data in the array
The create
block creates 50 task records in one go (if there are that many) - more on this here
Okay, I plan on playing with this more tomorrow, but it looks like it is going to work– THANK YOU! I am so excited about how much time this is going to save our nonprofit so we can focus less on admin and more on our mission :grinning_face_with_big_eyes:
If I may ask another question in my pursuit to build make a magical project management base… Now that I have the Projects, Tasks, Project Templates, and Task Templates tables---- in the Task Templates table, I have a # field that notes how many days before/after an Event Date that the task should occur. In the Projects table, I have a date field that is the Event Date… my goal is that, in the Tasks table, when tasks are generated for a specific project, that the combo of Event Date (from Projects table) and Days/Before After Event that a task should occur (from Tasks Template table) will create a NEW date in the Tasks table of what day the task for that specific project should occur, so let’s say:
- From Task Templates, the “Coordinating volunteers” should happen -30 to an event date
- I generate tasks for our April group exhibition, which in Projects table is noted as opening April 4
- in the Tasks table, the “Coordinating volunteers” task generates a March 4 date in a “Deadline” date field.
Can you tell me how to make this happen? :star_struck:
Okay, I plan on playing with this more tomorrow, but it looks like it is going to work– THANK YOU! I am so excited about how much time this is going to save our nonprofit so we can focus less on admin and more on our mission :grinning_face_with_big_eyes:
If I may ask another question in my pursuit to build make a magical project management base… Now that I have the Projects, Tasks, Project Templates, and Task Templates tables---- in the Task Templates table, I have a # field that notes how many days before/after an Event Date that the task should occur. In the Projects table, I have a date field that is the Event Date… my goal is that, in the Tasks table, when tasks are generated for a specific project, that the combo of Event Date (from Projects table) and Days/Before After Event that a task should occur (from Tasks Template table) will create a NEW date in the Tasks table of what day the task for that specific project should occur, so let’s say:
- From Task Templates, the “Coordinating volunteers” should happen -30 to an event date
- I generate tasks for our April group exhibition, which in Projects table is noted as opening April 4
- in the Tasks table, the “Coordinating volunteers” task generates a March 4 date in a “Deadline” date field.
Can you tell me how to make this happen? :star_struck:
Hi @Jessica_Pena - so the way I would do this is to have the "days before event’ field on the task template, like this:

Then, when the script runs, we copy this value over to the tasks table - modified script here:
let projectsT = base.getTable('Projects');
let tasksT = base.getTable('Tasks');
let projectTemplateT = base.getTable('Project Templates');
let tasksTemplateT = base.getTable('Task Templates');
let tasksTemplateQ = await tasksTemplateT.selectRecordsAsync();
let project = await input.recordAsync('Pick a project', projectsT);
let projectTemplate = await input.recordAsync('Pick a project template', projectTemplateT);
let projectTasks = [];
if (projectTemplate) {
output.text(`Creating tasks for ${project.getCellValueAsString('Name')} using template ${projectTemplate.getCellValueAsString('Name')} ... please wait`);
for (let projectTask of projectTemplate.getCellValue('Tasks')) {
let task = tasksTemplateQ.getRecord(projectTask.id);
projectTasks.push(
{
fields: {
'Task': task.name,
'Days before event': task.getCellValue('Days before event'),
'Project': [ {id: project.id} ]
}
}
)
}
}
while (projectTasks.length > 0) {
await tasksT.createRecordsAsync(projectTasks.slice(0, 50));
projectTasks = projectTasks.slice(50);
}
With the days before
value in the task table and the event date on the project table, you can combine these and come up with a date when each task needs to be complete by based on the project event date:

The “task completed by” field is:
DATEADD({Go Live Date}, {Days before event} * -1, 'days')
Is there a template available? @JonathanBowen @Jessica_Pena
@Jessica_Pena - we just need to extend the model and the script to accommodate different types of project templates. There’s probably a few ways to do this, but here’s my thoughts:
Base - pretty much the same as before, but we’ve got an additional “project templates” table:

Project Templates and Task Templates are a linked pair of tables that define the project type/template and the tasks for that type:


Now what we want to do in our script is pick a project that we want to set up and the template that we want to apply to it. So our script is:
let projectsT = base.getTable('Projects');
let tasksT = base.getTable('Tasks');
let projectTemplateT = base.getTable('Project Templates');
let project = await input.recordAsync('Pick a project', projectsT);
let projectTemplate = await input.recordAsync('Pick a project template', projectTemplateT);
let projectTasks = [];
if (projectTemplate) {
output.text(`Creating tasks for ${project.getCellValueAsString('Name')} using template ${projectTemplate.getCellValueAsString('Name')} ... please wait`);
for (let task of projectTemplate.getCellValue('Tasks')) {
projectTasks.push(
{
fields: {
'Task': task.name,
'Project': [ {id: project.id} ]
}
}
)
}
}
while (projectTasks.length > 0) {
await tasksT.createRecordsAsync(projectTasks.slice(0, 50));
projectTasks = projectTasks.slice(50);
}
The script flow is:
- Pick a project
- Pick the project type/template you want to apply
- Get the tasks for this template
-
push
these tasks into an array which suitable for the Tasks table
- create the records in the tasks table based on the data in the array
The create
block creates 50 task records in one go (if there are that many) - more on this here
I took this script and tried to modify it to use for my onboarding workflow base. My tables are Onboarding, Onboarding Tasks, and Onboarding Task Template. I am getting an error at line 15. Any help would be appreciated.
ERROR
ReferenceError: OnboardingTaskTemplateQ is not defined
at main on line 15
See modified script below:
let onboardingT = base.getTable('Onboarding');
let onboardingTasksT = base.getTable('Onboarding Tasks');
let onboardingTaskTemplateT = base.getTable('Onboarding Task template');
let onboarding = await input.recordAsync('Pick a user', onboardingT);
if (onboarding) {
output.text(`You picked ${onboarding.getCellValueAsString('Name')}`);
output.text(`Creating tasks for ${onboarding.getCellValueAsString('Name')} ... please wait`);
let onboardingTaskTemplateQ = await onboardingTaskTemplateT.selectRecordsAsync();
let onboardingTasks = [];
for (let task of OnboardingTaskTemplateQ.records) {
onboardingTasks.push(
{
fields: {
'onboardingTask': onboardingtask.name,
'Onboarding': [ {id: onboarding.id} ]
}
}
)
}
await onboardingTasksT.createRecordsAsync(onboardingTasks);
output.text('Onboarding Tasks created!')
}