Help with script please

In the following script, I would like to assign current draft’s contents as the “event.title”. Your help is greatly appreciated.

var calendar = Calendar.findOrCreate(“Activities”);
var event = calendar.createEvent();
event.title = “Dinner Party”;
event.notes = “Bring side dish.”;
event.startDate = Date.parse(“7pm next friday”);
event.endDate = Date.parse(“10pm next friday”);
event.isAllDay = false;
if (!event.update()) {

To literally set the full content of the draft as the title, you would use:

event.title = draft.content;

I might recommend you take it a step further, and use template tags like:

event.title = draft.processTemplate("[[title]]");
event.notes = draft.processTemplate("[[body]]");

This would be equivalent to using those tags in a step with templates, and assign the first line of the draft as the title, and the remaining text of the draft as the notes.

Hope this helps!

Definitely helps Thanks v much !