Missing fields when getting task

Hi,

In the documentation, it says when getting a task, it can return an array of custom fields alongside “is_global_to_workspace”. However when I try this in the API explorer it doesn’t seem to return that.
I even tried “opt_fields=custom_fields.is_global_to_workspace” and it still didn’t show up.

Is the API suppose to return this field when getting a task?

Hello @ambforumleader
Anyone can help @Tony_Anh_Nguyen with this query regarding API and missing fields?

Thanks,
Rashad

1 Like

@Phil_Seeman is it correct to say such information won’t be given at the task level because it belongs to the project settings instead? :thinking:

No, is_global_to_workspace is a property of a custom field, not of a custom field setting.

But a custom field is an object property on a task and is_global_to_workspace is an opt_in property of that object; because of the combination of those two facts, I don’t think there’s any way to obtain is_global_to_workspace when querying a task. You’ll have to get it via a separate call. If you give some more context as to when/what you’re doing around the call to get a task, I can give some additional suggestions as to what call might be the best to use. Like, are you always in one project and getting a task that’s in that project, or you’re getting random tasks that could be in any project in the workspace, etc.?

So effectively I am creating an application to save a project as a template which can then be used to initialise future projects.
I was going to use is_global_to_workspace to filter out the task’s custom fields which were specific for that project because it would be easier to “add” global custom fields to a new project rather than having to recreate it.

I can definitely get around this by just comparing the task’s custom field with the project’s custom field setting (which does show the is_global_to_workspace ) and then go from there. I was just a little confused with the documentation as it said the task’s custom field would return is_global_to_workspace .

Yep, that’s definitely what I would do.

Ah, I see that - sure doesn’t look right to me, unless I’m missing something. @AndrewWong could you check on this? In the example code snippet for Asana, it shows the custom field property including is_global_to_workspace but that’s an opt_in property so I don’t see how that result could come back from the endpoint as shown.