Script Action - Duplicate task + Add duplicated task to a specific project & section

We have a partnership with another business unit that requires some nuanced task sharing. I’ve tested this script in the “Run script” rule action, and it does 99% of what I need, which is:

  • Duplicate the task in question
  • Carry over the connection to the parent task, the description, and attachments

What’s missing: Home the duplicated task in a specific section of their separate project.

Can anyone help me integrate that into it? If it requires me to obtain anything other than the project URL, please break the instructions down to a kindergarten reading level. :grimacing:

async function run() {
  const triggeringTask = await
tasksApiInstance.getTask(task_gid);

  await tasksApiInstance.duplicateTask({
   data:{
    name: triggeringTask.data.name + ' - MSR Tool Update',
    include: "attachments,followers,notes,parent"
   }
  }, task_gid)
}
run();

👍

👀

🙌

Hi :waving_hand:

Shouldn’t be too hard, if possible ask AI to help you with the code. The right endpoint is Add task to section

Is it always in the same project/section? or does it vary?

Thanks for the reply! It’s always the same project and section.

In that case the code could include the exact project gid and the exact section gid. Do you know how to get those?