Possibility to add operators for DataService searches to a Products field?

Hi! I’m trying to make a query using the DataService and search for the field “InriverEntityId” that has the FieldType “InriverTextReadOnly”. When I’m running the search I get the following error: “No field with id ‘InRiverEntityId’ and operator ‘eq’.”, so I assume that this type isn’t searchable then? So can one add operators in some way for this field?

Thank you!
//Niklas

What if you add the type as a description to the field and try to lookup on that?

If you have the definition for the custom field InriverTextReadOnly, you can extend its operators to include an “eq” option.

In the custom class that inherits from FieldTypeBase, add the code below:

protected override List<FilterOperator> InitFieldOperators()
{
    var operators = base.InitFieldOperators();
    operators.Add(new FilterOperator
    {
        Operator = "eq",
        NeedsValue = true,
        ValueType = "string",
        GetDataExpression = v => x => x.TextValue == (v as string),
        FilterNeedResult = true
    });

    return operators;
}
1 Like

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