How to get the current value of custom fields using advanced search on a task?

advancedsearch
#1

So…I took the plunge and purchased Premium. Working with advanced search I have learned to get all the uncompleted tasks in a team with certain field values. How Do I get the value of a specific custom field?

Also, I see that when querying tasks I get a nice list of all the tasks meeting my query. When I get projects and assignee I get ID’s but not name or other human readable. Is there a way to get project name in addition to the project ID’s without doing a secondary query? Same for assignee…can I get assignee name rather in addition to ID in the same query?

#2

Hi @Eric_Snyder

Have you tried exporting an Advanced Search as a CSV? I’ve always found that Advanced Search works really well to get a quick, high-level overview but if I want detail, I always export. You get much more information, and you can filter/use formulas to get what you want.

1 Like
#3

To get these “human readable” data, you can query for “name” with the opt_fields parameter, like:
opt_fields=…,name,projects.name,assignee.name,…
Or, for project, use memberships instead of projects field, and also get sections name:
opt_fields=memberships.section.name,memberships.project.name

#4

I should have mentioned that I am using the API.

1 Like
#5

OK. More progress. I am getting custom fields ID and GID but I cannot get name. I am using:

opt_fields=custom_fields.9999999999999.name (with 9999999999999 replaced with id/gid - they are the same)

I have tried some other combinations and nothing seems to get me more than:

“custom_fields” : [ {
“id” : 9999999999999,
“gid” : “9999999999999”
} ]

#6

Ah, okay! Sorry about that. You’re already operating way past my abilities!

I hope you manage to get it sorted.

1 Like
#7

I wouldn’t be so quick to say that! I didn’t even know that export existed. I’m just working somewhere different. :wink:

1 Like
#8

Try opt_expand instead of opt_fields.

#9

I found one way by doing:

custom_fields.enum_value,custom_fields.name

1 Like
#10

I just tried this. It did not work for me.

#11

Ah, well. Perhaps opt_expand isn’t available for the Search API.

#12

opt_fields and opt_expand both work for the search API. However, @Eric_Snyder ultimately came to the answer: selecting fields in a response is not the same as specifying filters in the search query. To filter on a particular custom field in the request, use custom_fields.<id>.value=..., but to select custom fields in the response, use opt_fields=custom_fields.name without the intervening ID.

1 Like
#13

WOW!!! Even a blind squirrel finds a nut now and then!!! :man_dancing:

1 Like
#14

Thanks for the clarification.
With custom_fields.text_value I do get the values I need.
Is there a way to specify the custom fields I need to be returned. Well, okay it is easy to filter the json.

#15

For future reference:
Text - use custom_fields.text_value
Drop down (Enum) - use custom_fields.enum_value
Number - use custom_fields.number_value