Get "body of Draft

Hi, I am working on a script to create a calendar entry from a draft. I would like the first line of the draft be the title of the event and the rest of the draft to go into the notes / description field on the event. Here is the code I have:

event.title = draft.displayTitle;
event.notes = 'From Drafts App: ' + '\n' + draft.content;

draft.content contains both the displayTitle (first line) and the rest of the daft. I guess I would need to find a way in JavaScript to delete text from draft.content, like searching for first new line, the outputting the rest of draft.content to event.notes? Is there another way to accomplish this?

You can use the template engine in script to process tags the same way they would be in a templated action step. That’s the best way to get consistent results: Like:

let body = draft.processTemplate("[[body]]");

Awesome. That works perfectly!