Assign new task to multiple projects API Javascript

Trying to add a new task to more than one project, anyone see what I’m doing wrong here? This is with Google Script (JavaScript)

var payload =
	{
		"team" : "team_ID", 
            "projects" : ["proj_ID", "proj_ID"], 
		"assignee" : assignee,
		"name" : preTitle + title, // Task title
		"html_notes" : "<body>" + body + "</body>", 
		"due_on" : d.format("Y-m-d"), 
		"followers" : assignee,
	};

var options = { "method" : "post", "payload" : payload, "muteHttpExceptions": true};
options.headers = AuthData();


var response = UrlFetchApp.fetch("https://app.asana.com/api/1.0/tasks/?opt_pretty", options);

I get this error: projects: Not a Long: [Ljava.lang.Object;@48

Thank you!

And if you don’t have the projects attribute that works well? :thinking: I don’t see anything suspicious in your code…
If you look at Create a task and the body parameter on the right, it looks like yours…

Thanks @Bastien_Siebman. I did abandon this project and went with Microsoft’s environment as we have full access to their suite.

1 Like