Automatically add current date to Meeting Template

Hi,
Hopefully this is something really easy that I’m missing and someone can help me out.

I have a meeting template set up as an action, which works fine, but in the body of the meeting template I’d like it to automatically add the current date when the action is run. So for example I’d get “Meeting [current date]” as a title.

Thanks

This can be done. I think the Drafts templates documentation should put you on the right path:

https://getdrafts.com/actions/templates

If not, let me know and I’ll try to help further.

Dave

Thanks for the tip, but I’ve already tried adding date | %d-%m-%Y with the double brackets (yep, I’m a Brit) to the body of the template, but it just came out as the formula.

ok, can you share the action you’re using so I can take a look?

I’m a Brit too :slight_smile:

Sure, hopefully this works - I’ve exported the action as a URL -

drafts5://action?data=%7B%22uuid%22:%2273227671-AD8B-4E44-BB95-BD836E7263C3%22,%22steps%22:%5B%7B%22platforms%22:3,%22data%22:%7B%22script%22:%22%5C/%5Cn%20%20Create%20new%20draft%20with%20template%20text%20and%20tag%20assigned.%5Cn%5C/%5Cn%5Cn%5C/%5C/%20create%20template%5Cnconst%20template%20%3D%20%60%23%23%20Meeting%20Notes%20%5B%5Bdate%20%7C%20%25d-%25m-%25Y%5D%5D%5Cn%5Cn-%20Company:%5Cn-%20Topic:%20%5Cn-%20Attendees:%5Cn%5Cn%23%23%23%23%20Minutes%5Cn%5Cn%23%23%23%23%20Actions%5Cn%5Cn%60;%5Cn%5Cn%5C/%5C/%20create%20the%20draft%5Cnvar%20d%20%3D%20Draft.create();%5Cnd.content%20%3D%20template;%5Cnd.addTag(%5C%22meeting%5C%22);%5Cnd.update()%5Cn%5Cn%5C/%5C/%20load%20in%20editor%20and%20focus%20for%20editing%5Cneditor.load(d);%5Cneditor.activate()%22%7D,%22type%22:%22script%22,%22isEnabled%22:true,%22uuid%22:%2290DEB1A5-1A6E-440F-8921-A91EF4D7A4A5%22%7D%5D,%22groupDisposition%22:0,%22shortName%22:%22Meeting%22,%22shouldConfirm%22:false,%22disposition%22:3,%22keyCommand%22:%7B%22optionKey%22:false,%22input%22:%22%22,%22controlKey%22:false,%22commandKey%22:false,%22type%22:%22action%22,%22discoverabilityTitle%22:%22Meeting%20Template%22,%22shiftKey%22:false%7D,%22logLevel%22:2,%22notificationType%22:2,%22tintColor%22:%22none%22,%22actionDescription%22:%22Create%20a%20new%20draft%20pre-filled%20with%20template%20content,%20and%20already%20assigned%20a%20%E2%80%9Cmeetings%E2%80%9D%20tag.%22,%22keyUseIcon%22:false,%22icon%22:%22memo%22,%22visibility%22:2,%22groupUUID%22:%22E0B588CF-438C-4D42-A444-0A7A49CA87B3%22,%22assignTags%22:%5B%5D,%22name%22:%22Meeting%20Template%22%7D

Ok,

A couple of things. I got an error relating to the comment at the top, the single '/'s were the problem. I just deleted the comment. It wasn’t related to the template issue.

For the template issue there are two things:

The template needs to be processed. Just assigning it to the draft content isn’t enough. You need to change:

d.content = template

to

d.content = d.processTemplate(template)

Secondly, the template itself has spaces where it shouldn’t. It needs to be:

[[date|%d-%m-%Y]]

Changing those two things made it work for me.

Dave

Perfect!

Thanks for your help Dave.

You’re welcome

Cheers

Dave