Get Category by FieldTemplateSystemId

Is it possible to retrieve all categories of a certain fieldtemplatesystemid? I have created a secondary categoryFieldTemplate that is used for another purpose than the regular category and want to get the complete list of entities with this field template.

Tried to achieve it using DataService, but FieldTemplateSystemId doesn’t appear to be queryable for Category.

Litium version: 7.7.9

You could get all categories with dataservice and then filter them on the FieldTemplateSystemId when you have them all. Should not take noticable longer then finding the correct once inside the dataservice.

I don’t know if you can make your own extensions for the category query. I have not tested this, but give this a try:

using (var db = _dataService.CreateQuery<Category>())
                {
                    categories = db.Filter(f =>  new TemplateQueryExpressionInfo()
                    {
                        SystemId = Guid.Empty,
                        OperatorName = "eq"
                    }).ToList();
                }
2 Likes

Worked fine, thanks!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.