<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>How can we use filter in graphql (/o/api) to filter based on custom fields</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=120075224" />
  <subtitle>How can we use filter in graphql (/o/api) to filter based on custom fields</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=120075224</id>
  <updated>2026-04-05T09:58:27Z</updated>
  <dc:date>2026-04-05T09:58:27Z</dc:date>
  <entry>
    <title>RE: How can we use filter in graphql (/o/api) to filter based on custom fie</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120093227" />
    <author>
      <name>Luis Miguel Barcos</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120093227</id>
    <updated>2020-10-14T08:51:56Z</updated>
    <published>2020-10-14T08:51:56Z</published>
    <summary type="html">Hi Bhargav Vaghasiya.&lt;br /&gt;I was investigating about that and I found this: &lt;a href="https://github.com/liferay/liferay-portal/blob/master/modules/apps/headless/headless-admin-user/headless-admin-user-impl/src/main/java/com/liferay/headless/admin/user/internal/odata/entity/v1_0/UserAccountEntityModel.java"&gt;https://github.com/liferay/liferay-portal/blob/master/modules/apps/headless/headless-admin-user/headless-admin-user-impl/src/main/java/com/liferay/headless/admin/user/internal/odata/entity/v1_0/UserAccountEntityModel.java&lt;/a&gt;&lt;br /&gt;It seems like the filter for custom fields for user accounts is not supported yet.&lt;br /&gt;But, if you have created your custom field searchable, you can search the Speciality by its value. I mean, you can do something like this:&lt;br /&gt;query {&lt;br /&gt;  userAccounts(search: &amp;#34;dermatologia&amp;#34;) {&lt;br /&gt;    items {&lt;br /&gt;      emailAddress&lt;br /&gt;      id&lt;br /&gt;      name&lt;br /&gt;      customFields {&lt;br /&gt;        name&lt;br /&gt;        customValue {&lt;br /&gt;          data&lt;br /&gt;        }&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;And received the following response&lt;br /&gt;{&lt;br /&gt;  &amp;#34;data&amp;#34;: {&lt;br /&gt;    &amp;#34;userAccounts&amp;#34;: {&lt;br /&gt;      &amp;#34;items&amp;#34;: [&lt;br /&gt;        {&lt;br /&gt;          &amp;#34;emailAddress&amp;#34;: &amp;#34;luismitest@liferay.com&amp;#34;,&lt;br /&gt;          &amp;#34;id&amp;#34;: 38306,&lt;br /&gt;          &amp;#34;name&amp;#34;: &amp;#34;luismi test&amp;#34;,&lt;br /&gt;          &amp;#34;customFields&amp;#34;: [&lt;br /&gt;            {&lt;br /&gt;              &amp;#34;name&amp;#34;: &amp;#34;Speciality&amp;#34;,&lt;br /&gt;              &amp;#34;customValue&amp;#34;: {&lt;br /&gt;                &amp;#34;data&amp;#34;: &amp;#34;Dermatologia&amp;#34;&lt;br /&gt;              }&lt;br /&gt;            }&lt;br /&gt;          ]&lt;br /&gt;        }&lt;br /&gt;      ]&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;Hope this helps you.</summary>
    <dc:creator>Luis Miguel Barcos</dc:creator>
    <dc:date>2020-10-14T08:51:56Z</dc:date>
  </entry>
  <entry>
    <title>How can we use filter in graphql (/o/api) to filter based on custom fields</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120075223" />
    <author>
      <name>Bhargav R Vaghasiya</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120075223</id>
    <updated>2023-03-14T12:59:44Z</updated>
    <published>2020-10-09T10:56:12Z</published>
    <summary type="html">&lt;strong&gt;I need to fetch all users from the Liferay (GraphQL) based on the value of the custom field&lt;br /&gt;&lt;/strong&gt;&lt;strong&gt;I am using GraphQL in Liferay from /o/api&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;I am only able to filter the data based on email ID and user ID, here is my query for that&lt;br /&gt;=======================================================================================&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;query {&lt;br /&gt;  userAccounts(filter:&amp;#34;emailAddress eq &amp;#39;test@liferay.com&amp;#39;&amp;#34;){&lt;br /&gt;    items{&lt;br /&gt;      emailAddress&lt;br /&gt;      id&lt;br /&gt;      name&lt;br /&gt;      customFields{&lt;br /&gt;        name&lt;br /&gt;        customValue{&lt;br /&gt;          data&lt;br /&gt;        }&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;=======================================================================================&lt;strong&gt;Result:&lt;/strong&gt;======================================================================================={&lt;br /&gt;  &amp;#34;data&amp;#34;: {&lt;br /&gt;    &amp;#34;userAccounts&amp;#34;: {&lt;br /&gt;      &amp;#34;items&amp;#34;: [&lt;br /&gt;        {&lt;br /&gt;          &amp;#34;emailAddress&amp;#34;: &amp;#34;test@liferay.com&amp;#34;,&lt;br /&gt;          &amp;#34;id&amp;#34;: 20126,&lt;br /&gt;          &amp;#34;name&amp;#34;: &amp;#34;Test Test&amp;#34;,&lt;br /&gt;          &amp;#34;customFields&amp;#34;: [&lt;br /&gt;            {&lt;br /&gt;              &amp;#34;name&amp;#34;: &amp;#34;Speciality&amp;#34;,&lt;br /&gt;              &amp;#34;customValue&amp;#34;: {&lt;br /&gt;                &amp;#34;data&amp;#34;: [&lt;br /&gt;                  &amp;#34;Cardiologia&amp;#34;&lt;br /&gt;                ]&lt;br /&gt;              }&lt;br /&gt;            }&lt;br /&gt;          ]&lt;br /&gt;        }&lt;br /&gt;      ]&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;=======================================================================================&lt;br /&gt;but i want to filter based on value of the custom fieldName of the custom field: &amp;#34;Speciality&amp;#34; and possible (selectable) value is   {Cardiologia, Dermatologia, vagh3}I have tried lot&amp;#39;s of way to achieve this but every time failed........I am loosing my hopeCan we filter the data based on custom fields? and if Yes, then how?????</summary>
    <dc:creator>Bhargav R Vaghasiya</dc:creator>
    <dc:date>2020-10-09T10:56:12Z</dc:date>
  </entry>
</feed>
