How to get priority field on tasks?

Hi there! I’m currently trying to use the API to fetch tasks from a project.
However, I cannot find in the API how to get the Priority field that is built-in in Asana.

Could anyone help me on that and tell me where/how to find it?

Note: I also tried getting a single task to get all fields, it’s not appearing there easier…

Hi @Gurvan_Beka and welcome to the forum,

Priority isn’t any special built-in field; it’s just a custom field that Asana creates in new accounts. So you want to look in the custom_fields structure that gets returned. (Depending on the endpoint you’re using, you may need to ask for it specifically with a URL parameter like ?opt_fields=custom_fields.)

1 Like

That’s what I found I am supposed to do, but custom fields appear to just be empty, or non-existent…?

Even through Asana API explorer, when I fetch a task that I know has a Priority set, custom_fields never shows up, even if explicitly selected in opt_fields.

Are you authenticating to Asana with a guest account? My recollection is I think guests don’t have access to custom fields in the API.

What do you mean a guest account? I don’t think so, I’m the owner of the Team/Workspaces I work with.

Can you share a screenshot of your API explorer? (bonjour :wave: je suis français :slight_smile: )

Sure! Here are 2 screenshots:

Standard request, without any opt_fields:

(ohh un français ici, je m’y attendais pas :smiley: :wave: )

And here’s the second one, because as a new user I’m not allowed to send 2 embedded medias (oh and too quickly, gotta wait those 10 seconds):

Request with opt_fields=custom_fields:

I believe I read somewhere that we soon (or already) won’t be able to choose an entire entity as an opt_fields but will have to specify things like custom_fields.gid. I also remember @Phil_Seeman saying it wasn’t true. Are you able to try with the API explorer?

No matter if I use custom_fields, custom_fields.gid, custom_fields.name, it returns this:

Can you try requesting other fields just to see if it does impact the result, like name and notes? Are you sure this task has custom fields :sweat_smile: ?

Here’s the request with other fields:

And yes, it has a priority set:

I am out of ideas :sweat_smile: @Phil_Seeman ?

1 Like

@Gurvan_Beka,

I would try doing the call in Postman, because if you ask for opt_fields=custom_fields and there is some type of access issue (which is what I’m suspecting), you should get a specific error message back which will typically tell you the exact problem.

I’m using Paw when running my tests, similar to Postman, and it returns the same results as when using API Explorer, that means it returns tasks, without custom_fields field.
As said before, I’m the organization/team owner anyways, so there shouldn’t be any access issue?
I can see the task in Asana aswell.

I would try two things:

Try getting the custom field using this endpoint and see what happens: Asana

And try getting the custom field settings in the Gurvan project using this endpoint and see what happens: Asana

Hopefully the result from one or both of those calls will provide a clue as to what’s going on (namely, I’m hoping one or both will return an error and the accompanying message will be the clue).

Interestingly, here’s what is returned when trying to get custom field settings in the project:

However I am able to set the priority field, therefore I assume that either the error isn’t correct, or there is another (yet undocumented) field for priority?

As for the first endpoint, I do not know what would the custom field ID be, how am I supposed to get it?

image
image

Yes, bingo! This is exactly what I was leaning toward to be the issue.

Without seeing all of the aspects of your Asana configuration, I can’t tell you exactly what the underlying problem source is, but I can promise you: at least for the workspace you’re querying in, Asana sees the account that you’re authenticating with for your API calls to be a free Asana account.

I understand that it can’t be a free account for the user you’re logged into in the UI, because you can access the Priority field in the Asana UI, but for whatever the reason, the API sees the authenticating user as a Free user.

What subscription level do you have? Is this a Workspace or an Organization? Are you in a Division within a larger organization account? Was this a trial account that expired? Do you have multiple users set up, and the user you’re logged into for the UI is a different user than you’re authenticating to in the API? I’m just throwing out ideas that come to mind to try and help point you toward the answer.

1 Like

Uhm, actually, I am using a free Asana account and have always been…?

To answer all of your questions, respectively: I do not have any subscription level and never had (not even free trial), this is an organization, there isn’t any other organization account, no trial, I am actually working with 2 users, but both are according to the other questions.

The fact that you seem to say priority field is only for paid users is weird to me, I’ve always been able to use priority field no matter what???