I have a requirement where I have to fetch items from custom meta having certain values. For example I have to fetch all the items from custom meta where key value in {'news','videos'}. What I am doing is:

CustomMetaValueCriteria metaValueCriteria = new CustomMetaValueCriteria("news", Criteria.Equal);
CustomMetaValueCriteria metaValueCriteria1 = new CustomMetaValueCriteria("videos", Criteria.Equal);
Criteria FinalCriteria = CriteriaFactory.Or(metaValueCriteria, metaValueCriteria1);

If there are multiple values, I will have to create multiple criteria in a loop. Is there any better way of doing so (for example inCriteria)

Regards, Rajendraa

2 Answers 2


As far as i know there isn't a really easy way. The InCriteria is used for taxonomy; not for custom meta. You can however use CriteriaFactory.Or(Criteria[]), so you only need a single Or. You will have to instantiate all the Criteria to use there though.

On a side note, such a setup would be usefull to have as IN is a SQL statement, it would probably improve performance if Tridion would offer this feature!



  • ideas.sdltridion.com :)
    – Nuno Linhares
    Commented Apr 3, 2013 at 10:51
  • Thanks Rogier, Yes i am aware of crieriafactory.or where i can pass the array of criteria but the thing is i will have to instantiate all the criteria before creating the array. Actually i have a sql query using in and i am trying to convert the logic into content delivery api Commented Apr 4, 2013 at 3:06
  • Actually, you'll have to do this yeah. It's not pretty, and i don't like it either. What i typically do is write a support function to create the array for me; pass the array (or csv string) into the function and have the repetitive stuff handled by a loop. Commented Apr 4, 2013 at 15:20

The InCriteria is a bit of a special one, the documentation describes it as follows:

The InCriteria is used when a repetitive type of condition occurs, for example when the Item may be related to one or more taxonomyfacets. The In operator combines the child criteria and selects all items that comply to one of the criteria.

So you will still need to construct an OrCriteria with all your CustomMetaValueCriteria inside.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.