Improved Zapier Functionality (For Project Creation)

@anon86052188,

You’re not using correct field names. Things like addSection, addDate, etc. are not valid names. You need to use correct field names as defined here in the API docs:

@Phil_Seeman I see,
as per the documentation, for dates the parameter is due_on which works and projects it is addProjects which does not work.

For custom fields I saw in the forums that it’s custom_field[1199105026482630]="Value" and that doesn’t work either, nor does custom_fields

does a PUT request for updates only accept certain parameters?

No, addProjects is not a field name. addProject is the name of a separate API endpoint that add a project to an existing task:

https://developers.asana.com/docs/add-a-project-to-a-task

When creating a new task, there is a field projects that can assign the new task to one or more projects. But that field is only valid when creating a new task. To add a project to an existing task like in your use case, you have to use that separate addProject endpoint; you can’t add a project to an existing task via the endpoint you’re using that updates an existing task.

For custom fields, I can’t recall the exact syntax you need, but try putting the custom field gid in quotation marks and see if that helps; i.e. something like:

custom_fields["1199105026419"]

I see, so to update an existing task not all details of the task could be update from a PUT request and that includes adding a Project to the task?

As for the custom fields, this is the error I get

Exactly!

Try this: in the KEY field, put
custom_fields

In the VALUE field, put
{"1199105026482630": "7648"}

See if that works…

Success!!
In postman and Zapier.

As for the other fields, In general -

In general how would I know that, is it documented? How do I know which fields / parameters work or do not work?

Yay!

Yep, it is. From the schema documentation for a task:

image

Got it!
Thanks :hugs:

@Phil_Seeman Everything works well, except when trying to submit 2 Custom fields only 1 of them goes thru…
This is occurring both in Zapier and Postman.

I’m assuming it’s because i’m using the same parameter, custom_fields twice.
I tried by using custom_fields[1] but that doesn’t work at all.

@anon86052188,

Can you post the exact syntax you’re using for the attempted inclusion of the 2 custom fields ?

@Phil_Seeman See screenshot.

Only the last custom field goes thru the request.

If it’s something that can’t be bypassed… perhaps the BatchAPI is an option - although i have no clue how that would work in terms of submitting it as form-data

@anon86052188,

Try this format:

KEY:
custom_fields

VALUE:
{“12345”: “https://somewhere.com”, “67890” : “7648”}

where “12345” and “67890” are custom field gids.

@Phil_Seeman

Threw an error

Hmmm, can you check your quotation marks to make sure they’re plain-vanilla quotes? In particular, the one just before “7648” looks suspect.

It worked!! Thank you!

1 Like

@Phil_Seeman Would you know anything about that? Quite a few instances where BatchAPI would be really helpful, For instance;

  • creating multiple subtasks
  • adding multiple tags
  • adding to multiple projects
  • Updating fields for multiple newly created (sub)tasks

I’ve never tried running the Batch API in Zapier, but here’s a forum post about it in which a possible way to do it is proposed:

Do let us know if you try it!

Thanks!

Going the route of using a looped array in Zapier wouldn’t be right since it’s something the BatchAPI would handle.

I guess going down the trenches in the forum would be a starting point…
https://forum.asana.com/search?q=Batch%20API%20order%3Alatest_topic

1 Like

hi there @abass - for some reason the file isn’t working when I try to open it. Could you share the details in text (or re-share the image) pls?