Skip to main content

Do you use Asana for Project and Task Management?

Do you have Custom Fields on your Asana Tasks?

If so - you might have noticed that Zapier doesn’t currently have the ability to update those Custom Fields in the Update Task action for Asana.

Whenever I see a case like this I immediately look for the answer to 2 questions.

  1. Does the Asana API use API Key for Authentication (rather than OAuth)?

  2. Does their Update Task endpoint provide the ability to update Custom Fields?

If the answer to both of those questions is “Yes” - we should be able to use Webhooks by Zapier to update the Custom Fields on the Task.

Question 1: Does the Asana API use API Key for Authentication?

It turns out they do. :)

You are able to generate a Personal Access Token (PAT) for use in API Calls.

Question 2: Does their Update Task endpoint provide the ability to update Custom Fields?

And we do have the ability to update the custom fields on a task using the Update Task endpoint.

https://developers.asana.com/docs/update-a-task

 

So both criteria for using Webhooks by Zapier to Update Custom fields on the Task are True.

Now it’s time to generate a Personal Access Token and test it out.

Generating an Asana Personal Access Token (PAT)

Asana has instructions for how to do this here:

https://developers.asana.com/docs/authentication-quick-start#app-or-pat

First we’ll navigate to this Permalink.

And once there - we’ll click the link to Generate a New Access Token.

 

We’ll Name our New Token and then click Create Token.

 

Then make sure to Copy the token and store it in a secure location.

Gathering the Required Information

In order to send the webhooks request - we’re going to need a couple of pieces of data.

First - we will need the Asana Task ID.

If you’re updating a Task - it should already exist so we would typically get the Task ID in one of 2 ways in the Zap.

  1. From the Trigger. In my example below - I’m going to use a Google Sheets Updated Row trigger to bring in the Task ID and the values I want for the Custom Field. But you may be storing it in another App which Triggers the Zap like Airtable or Pipedrive - or even using an Asana New Task in Project trigger.

  2. By searching for the Task in Zapier by using a Find Task in Project action.

The second thing we’ll need are the Custom Field IDs.

You’ll notice in Asana’s example above that the sample code looks like this.

"custom_fields": {
      "4578152156": "Not Started",
      "5678904321": "On Hold"
    }

Those Numbers on the left are the Custom Field IDs.

And we can get those in 3 steps.

  1. In Zapier - use one of the existing triggers or actions to find your Workspace ID.

  1. Put your Workspace ID into the URL structure below.

https://app.asana.com/api/1.0/workspaces/WORKSPACEID/custom_fields

  1. Make sure you’re logged into Asana and copy paste that URL with your workspace ID into your browser.

That will bring up all of your custom fields in a JSON format.

Use Ctl+F to Find or Search for the field name you’re looking for.

In my case - I have 5 Custom Fields for my test below.

The “gid” is the ID we will use to update this specific Custom Field in our Webhook Request.

Custom Text Field

{
    "gid": "1200210830546881",
    "name": "CustomText",
    "resource_subtype": "text",
    "resource_type": "custom_field",
    "type": "text"
  }

 

Custom Number Field

{
    "gid": "1200260667826518",
    "name": "CustomNumber",
    "precision": 0,
    "resource_subtype": "number",
    "resource_type": "custom_field",
    "type": "number"
  }

 

Custom Currency Field

{
    "gid": "1200260924395860",
    "name": "CustomCurrency",
    "precision": 0,
    "resource_subtype": "number",
    "resource_type": "custom_field",
    "type": "number"
  }

 

Custom Percent Field

{
    "gid": "1200260924537293",
    "name": "CustomPercent",
    "precision": 0,
    "resource_subtype": "number",
    "resource_type": "custom_field",
    "type": "number"
  }

 

Custom Drop-down Field with 3 Options

{
    "gid": "1200260725860904",
    "enum_options": >{
      "gid": "1200260725860977",
      "color": "green",
      "enabled": true,
      "name": "Test1",
      "resource_type": "enum_option"
    }, {
      "gid": "1200260725860991",
      "color": "red",
      "enabled": true,
      "name": "Test2",
      "resource_type": "enum_option"
    }, {
      "gid": "1200260819199057",
      "color": "orange",
      "enabled": true,
      "name": "Test3",
      "resource_type": "enum_option"
    }],
    "name": "CustomDropDown",
    "resource_subtype": "enum",
    "resource_type": "custom_field",
    "type": "enum"
  }

 

The Custom Drop Down options are a bit tricky - as rather than passing Asana the Name (“Test2” for example) - we’ll need to send them the GID for that option instead (1200260725860991)

Putting it All Together in a Zap

Now that we have all the pieces - we can build our test Zap.

As I mentioned above - I’m using a Google Sheets Updated Row trigger to start my Zap.

Basically - I’m adding the Task Name and ID from a separate Zap - then I want to update the Custom Fields on the Sheet to trigger my Zap and ultimately update the Asana task.

 

I have a Filter at Step 2 - so my Zap only continues once I add the word “Yes” to the Trigger Column on my Sheet above.

 

And then in Step 3 - I’m using a Webhooks by Zapier Custom Request.

Here are the important parameters on the request.

  1. The Method will be PUT

  2. The URL is https://app.asana.com/api/1.0/tasks/TASKID - where TASKID will be mapped in from another step of the Zap.

  3. The Data should follow the formatting below - you can see detailed examples including other fields that can be updated on Asana’s site here: https://developers.asana.com/docs/update-a-task

  4. There will be 2 Headers - the first is Content-type on the left - and application/json on the right

  5. The second Header is Authorization on the left - then Bearer (a space) and your Personal Access Token that you generated above.

Running the test - should update all the custom fields on my Asana task - and it does. :)

Summary

While Updating Custom Fields on an Asana Task isn’t currently built into the Asana Update Task action in Zapier - it is possible to update these fields using a Webhooks by Zapier Custom Request.

In order to do so - we need to generate a Personal Access Token from Asana and look up the ID values for our Workspace and each Custom Field.

Dropdown Custom Fields are a bit trickier since we have to pass the ID for the dropdown option to Asana and not the Name.

If you do test this out - I’d love to hear your experience (or any tips you learn) in the comments below!

Hey @jonathankmg!

Thrilled to hear that you got that working, and thanks for that extra tip as well — much appreciated :)


I’d like to note one additional thing. If you find that some of your custom fields are not showing using:

https://app.asana.com/api/1.0/workspaces/<WORKSPACEID>/custom_fields

Make sure to add the custom field to the “workspace field library”. If you don’t it will not show up in the list.

(see the screenshot below which shows you how to add the field to your workspace field library)

 

 


I just wanted to report back that this worked perfectly. Thank you!


Thank you. I will give this a shot and let you know how it goes.


Hi @jonathankmg - thanks for giving this a try!

I think you’re really close - and the issue here is the format of the JSON. 

Specifically this last comma after the ID of the Dropdown Option.

If we have multiple lines in the JSON we’d separate them with commas - but the last line will always not have a comma.

Notice in my screenshot here there is no comma on the last line only.

If you change the request to this format below (without the comma) - it should work.

{
"data": {
"custom_fields":{
"ID OF CUSTOM FIELD":"ID OF THE DROPDOWN OPTION"
}
}
}

Please let us know how it goes!


Hey @jonathankmg!

Awesome to see you trying to put this into practice 🙂 Let’s see if @Jared can chime in here with some pointers.


I wanted to have Zapier set a custom field to a specific dropdown value for each task created that has a specific tag. I use a filter after the task is create to say “If the newly created task has “design” as a tag.. keep going”. I then wanted it to set the dropdown field to a specific value.. the same value for each task created. I followed these instructions but since it was a dropdown, I was a bit uncertain on the syntax.

 

Here is what I put ::::::::::

Method: PUT

URL: https://app.asana.com/api/1.0/tasks/120….(TASKID)

Data Pass-Through? (blank)

Data:

    {

          "data": {

             "custom_fields":{

                 "ID OF CUSTOM FIELD":"ID OF THE DROPDOWN OPTION",

                }

            }

      }

 

Unflatten: yes

Basic Auth: (blank)

Headers

   Content-type: application/json

   Authorization: Bearer 1/118….

 

I got the error “ Could not parse request data, invalid JSON”. I’m not sure what I’m missing.


Reply