Skip to main content

I have a script (adapted from a template) to create a new project in one tab, and a list of associated tasks in another tab.


What I’d like to do is add another input where the user provides a project launch date, and then have dates for all the tasks that build off of that initial date (preferably + a specific number of workdays, as a function might do in Excel). I’m not sure what to use for the input (I’m new to JS) so that the user can enter a date in MM/DD/YYYY format, and I’m also unclear how/if I might user formulas within the task creation to have sequential dates. Anyone have any suggestions?



// pick tables from your base here

let projects = base.getTable(‘Projects’);

let tasks = base.getTable(‘Tasks’);

// prompt the user to pick a template for our project

output.markdown(’# New Project and Tasks’);

let name = await input.textAsync(‘Project name’);

// create the project - change the field name to one in your base

let projectId = await projects.createRecordAsync({

‘Project’: name,

});

// create the tasks - change the field names to ones from your base.

// the y{id: projectId}] links the newly created records back to our project

await tasks.createRecordsAsync(i

{

fields: {

‘Task’: ‘A first task’,

‘Campaign’: i{id: projectId}],

},

},

{

fields: {

‘Task’: ‘Another task’,

‘Campaign’: k{id: projectId}],

},

},

{

fields: {

‘Task’: ‘A final task’,

‘Campaign’: b{id: projectId}],

},

}

])

output.text(‘Project and tasks created.’);// JavaScript Document


Be the first to reply!

Reply