# Get Custom Field value with Python Search API

**URL:** <https://forum.asana.com/t/get-custom-field-value-with-python-search-api/157744>\
**Category:** API & Developers\
**Tags:** advanced-search\
**Created:** [17 March 2022 09:26 UTC](https://forum.asana.com/t/get-custom-field-value-with-python-search-api/157744 "2022-03-17T09:26:26Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon58537343](https://luna1.co/8d76cd.png) [@anon58537343](https://forum.asana.com/u/anon58537343)\
**Post date:** [17 March 2022 09:26 UTC](https://forum.asana.com/t/get-custom-field-value-with-python-search-api/157744/1 "2022-03-17T09:26:26Z")

</div>

Hello all,

I’m trying to use the Search API with Python to make an advanced search. I managed to do a search but I want to obtain one specific Custom Field but no matter how I do it, I can’t. I tried using custom\_fields.enum\_value, text\_value, and so on (the field is supposed to be a text field).

Here you have an example:

```auto
[{'gid': '1139247426380031', 'name': 'SUPPLIER'}, {'gid': '1139247426380041', 'name': 'Problem type'}, *{'gid': '1139247426380028', 'name': 'SKU Affected', 'text_value': None} **, {'gid': '1162394674904100', 'name': 'Courrier', 'text_value': None} ,** {'gid': '1167068898757021', 'name': 'Courier', 'text_value': 'UPS, UPS'}**, {'gid': '1167051532424011', 'name': 'SKU 1', 'text_value': None}, {'gid': '1167051532424050', 'name': 'Replacement Shipping data', 'text_value': None}, {'gid': '1167051532424053', 'name': 'Order Date', 'text_value': None}]

```

As you can see, I get none for the Text Value (in bold) but not for the other one.

Here you can see the definition of the Custom Field

```auto
{'gid': '1139247426380028',
 'name': 'SKU Affected',
 'created_by': {'gid': 'XXXX',
  'name': 'XXXXX',
  'resource_type': 'user'},
 'resource_subtype': 'text',
 'resource_type': 'custom_field',
 'type': 'text',
 'is_global_to_workspace': True}

```

How could I get this value? I’m pretty new with the API but I’m stuck here.  
Thank you so much in advance.

---

<div class="post-metadata">

**Author:** ![anon58537343](https://luna1.co/8d76cd.png) [@anon58537343](https://forum.asana.com/u/anon58537343)\
**Post date:** [17 March 2022 09:27 UTC](https://forum.asana.com/t/get-custom-field-value-with-python-search-api/157744/2 "2022-03-17T09:27:15Z")

</div>

I said “in bold” but seems like code blocks can’t be bold. Still the related field is SKU Affected

---

<div class="post-metadata">

**Author:** ![Bastien\_Siebman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/bastien_siebman/32/172354_2.png) [@Bastien\_Siebman](https://forum.asana.com/u/Bastien_Siebman)\
**Post date:** [18 March 2022 07:36 UTC](https://forum.asana.com/t/get-custom-field-value-with-python-search-api/157744/3 "2022-03-18T07:36:54Z")

</div>

Hi,

Can you share the params of your search request? You’ll have to ask for the right opt\_fields…

---

<div class="post-metadata">

**Author:** ![anon58537343](https://luna1.co/8d76cd.png) [@anon58537343](https://forum.asana.com/u/anon58537343)\
**Post date:** [18 March 2022 08:03 UTC](https://forum.asana.com/t/get-custom-field-value-with-python-search-api/157744/5 "2022-03-18T08:03:17Z")

</div>

Sure @Bastien_Siebman , I was playing around trying different options but they were like this

```auto
data = client.tasks.search_tasks_for_workspace(
        workspace_gid=WORKSPACE_GID,
        params={f'custom_fields.{SUPPLIER_FIELD_GID}.value':f'{SUPPLIER_GID}', 
                'created_on.after': '2020-02-15',
                'custom_fields.1139247426380041.value': PROB_TYPE_GID},
        opt_fields=['completed', 'name', 
                    'custom_fields.name', 
                    'custom_fields.text_value.name'], 
    
    )

```

---

<div class="post-metadata">

**Author:** ![Bastien\_Siebman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/bastien_siebman/32/172354_2.png) [@Bastien\_Siebman](https://forum.asana.com/u/Bastien_Siebman)\
**Post date:** [18 March 2022 08:18 UTC](https://forum.asana.com/t/get-custom-field-value-with-python-search-api/157744/6 "2022-03-18T08:18:01Z")

</div>

I think I know. The fields you are querying don’t exist, look at [Tasks](https://developers.asana.com/docs/task). No field “name” on “custom\_fields” on tasks, and “text\_value” is a string. So use `custom_fields.text_value` and that should work for text fields.

Let me know!

---

<div class="post-metadata">

**Author:** ![anon58537343](https://luna1.co/8d76cd.png) [@anon58537343](https://forum.asana.com/u/anon58537343)\
**Post date:** [18 March 2022 08:33 UTC](https://forum.asana.com/t/get-custom-field-value-with-python-search-api/157744/7 "2022-03-18T08:33:26Z")

</div>

Omg, thanks @Bastien_Siebman, that solved the problem. I was pretty sure I tried that option before but seems like I didn’t.

---

<div class="post-metadata">

**Author:** ![Bastien\_Siebman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/bastien_siebman/32/172354_2.png) [@Bastien\_Siebman](https://forum.asana.com/u/Bastien_Siebman)\
**Post date:** [18 March 2022 09:52 UTC](https://forum.asana.com/t/get-custom-field-value-with-python-search-api/157744/8 "2022-03-18T09:52:52Z")

</div>

My pleasure. I made the mistake of forgetting fields about a hundred times ^^what about you @Phil_Seeman ? 😛

---

<div class="post-metadata">

**Author:** ![Phil\_Seeman](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/phil_seeman/32/81525_2.png) [@Phil\_Seeman](https://forum.asana.com/u/Phil_Seeman)\
**Post date:** [18 March 2022 15:55 UTC](https://forum.asana.com/t/get-custom-field-value-with-python-search-api/157744/9 "2022-03-18T15:55:19Z")

</div>

> [@Bastien\_Siebman](#):
>
> I made the mistake of forgetting fields about a hundred times ^^what about you @Phil_Seeman

Oh, for sure! Probably a thousand times.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/system/32/276370_2.png) [@system](https://forum.asana.com/u/system)\
**Post date:** [30 May 2025 18:56 UTC](https://forum.asana.com/t/get-custom-field-value-with-python-search-api/157744/10 "2025-05-30T18:56:49Z")

</div>


