1

OK so I got entries articles with an asset field documents.
This asset field has an attribute called docType which is a dropdown with 5 values (A, B, C, D, E).

I d like to select all articles entries that have documents with docType=A criteria.

How can I dot that?
Should I make a relatedTo selection? I tried multiple things but nothing works.

Miguel Bocquier
  • 972
  • 1
  • 7
  • 19

1 Answers1

1

You can do it like explained in this answer, only that you also add your dropdown field parameter to your craft.assets criteria model:

{% set assets = craft.assets.docType('A').limit(null) %}

and then:

{% set entries = craft.entries.section('articles').relatedTo({
    targetElement: assets,
    field: 'documents'
}) %}
carlcs
  • 36,220
  • 5
  • 62
  • 139