Duplicate Project Using Zapier Code?

Hey guys!

I’m looking to improve our companies onboarding process. I want to use Zapier to duplicate a project template in Asana once our client makes a purchase using Stripe. As of now the base template for Asana in Zapier does not allow this functionality.

I came across this post earlier which uses Javascript to do just that. I have tried to replicate the code and keep getting a token error, I am not a big coder and have tried multiple variations.

Can someone help me trouble shoot my code (Below)

// get taskName from the custom fields above
var taskTitle = inputData.taskName;
var projectID = “xxxxxxxxxxxxx721”;
var teamID = “xxxxxxxxxxxxx729”;

let body = {
“data”: {
“include”: [
“members”,
“notes”,
“task_notes”,
“task_subtasks”,
“task_attachments”,
“task_followers”
],
// set the Task Name text value to be the this value from the above variable
“name”: taskTitle,
// set the Team ID value to be the this value from the above variable
“team”: teamID
}
};
// find the task based on the taskID
const res = await fetch('https://app.asana.com/api/1.0/projects/’+ projectID + ‘/duplicate’, {
method; ‘POST’,
headers: {
‘Authorization’: ‘Bearer xxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxx8959’
},
body; JSON.stringify(body)
});
const data = await res.json();
output = {data: data};

@jeffmankini

1 Like

Hi @Nick_Urso,

Can you post the exact text and/or screenshot of the error you’re getting, so we make sure we point you in the most appropriate direction?

1 Like