Action
Things Prompt
Adds a task to Things using a prompt.
Allows for natural languge start/reminder/due date entry.
Steps
-
script
// Adapted from "Add Single Thing" by @nahumck: https://actions.getdrafts.com/a/1DZ const areas = ['Work', 'Miscellaneous', 'Home', 'Long Term', 'Finance', 'Occasions', 'Waiting']; const createButtonText = 'Create in Things'; const prompt = Prompt.create(); prompt.title = 'Task to Things'; prompt.addTextField('task', 'Task', ''); prompt.addTextView('notes', 'Note', '', { height: 50 }); prompt.addTextField('when', 'Start', '', { placeholder: 'fuzzy date and/or time' }); prompt.addTextField('deadline', 'Due', '', { placeholder: 'fuzzy date' }); prompt.addSelect('area', 'Area', areas, [''], false); prompt.addButton(createButtonText); const didSelect = prompt.show(); const title = (prompt.fieldValues.task || '').trim(); const notes = (prompt.fieldValues.notes || '').trim(); const reminder = (prompt.fieldValues.reminder || '').trim(); const when = (prompt.fieldValues.when || '').trim(); const deadline = (prompt.fieldValues.deadline || '').trim(); const list = prompt.fieldValues.area; if (prompt.buttonPressed === createButtonText) { const todo = Object.assign(TJSTodo.create(), { title, when, deadline, notes, list }); const container = TJSContainer.create([todo]); const cb = CallbackURL.create(); cb.baseURL = container.url; const success = cb.open(); if (success) { console.log('Task created in Things'); } else { console.log(cb.status); context.fail('Error occured; see log'); } } else { context.cancel(); }
Options
-
After Success Default Notification Info Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.