Duplicating a project with JXA


#1

I am new to JXA/AppleScript and am trying to duplicate a project.

const omniFocus = Application('OmniFocus');
omniFocus.includeStandardAdditions = true;

const doc = omniFocus.defaultDocument;

const template = doc.flattenedProjects.whose( { name: '1:1 with team member' } )[0];

template.duplicate( {to: doc.projects} );

When run, I get an error:

Error on line 8: Error: Replacement not supported currently, please log a feature request if you need this.

Has anybody else run into this and figured out how to fix it? I saw a few old messages from a year or more ago with no answers, so figured I’d create a new message.

Running into issues trying to do something simple like this has me second guessing whether JXA will actually save me any time (since I know JavaScript) vs learning AppleScript. JXA documentation/examples are horrible. :-(