SAP Knowledge Base Article - Public

2372331 - Error: "Failed to retrieve result with given criteria." occurs when trying to filter on a picklist field using OData API - Recruiting Management

Symptom

You get the following error message, when you try to filter your OData API query using picklist (e.g. picklist ID): "Failed to retrieve result with given criteria".

Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.

Environment

SAP SuccessFactors Recruiting Management

Reproducing the Issue

1. Query an entity using OData API and use a custom picklist field in order to filter the results, e.g.:

GET .../odata/v2/JobApplication?$format=json&$filter=assessmentStatus/id eq '381'&$expand=assessmentStatus

2. An error is received:

{
"error": {
"code": "COE_GENERAL_SERVER_FAILURE",
"message": {
"lang": "en-US",
"value": "Failed to retrieve result with given criteria."
}
}
}

or "[COE0019]Failed to retrieve result with given criteria."

Cause

  • The custom picklist field has to be a reportable field in order to use it as a filter in the OData API call.
  • The query is executed on the PicklistOption entity, rather than a specific property, such as the label or the option id.

Resolution

The field definition ID has to be added to reportable custom fields. The ID can be found either in the oData API Dictionary, e.g.:


28-09-2016 14-17-30.png

or in the relevant XML template, e.g.:

<field-definition id="assessmentStatus" type="picklist" required="false" custom="true" public="false" readOnly="false" anonymize="false" forward-intact="true">
<field-label mime-type="text-plain"><![CDATA[Assessment Passed: ]]></field-label>
<field-description><![CDATA[Assessment Status]]></field-description>
<picklist-id>yesNo</picklist-id>
</field-definition>

If you are a Partner go to Provisioning > Configure Reportable Custom fields and add the field definition to reportable custom fields, e.g.:

28-09-2016 13-58-33.png

If you are a customer, please contact your Implementation Partner or SAP Product Support in order to make the field reportable.

More information on reportable custom fields can be found in the following Knowledge Base Article: 2081508

Note:

The filter query has to be executed on a specific property within the PicklistOption entity, e.g.:

  • $filter=assessmentStatus/id eq '381'
  • $filter=assessmentStatus/picklistLabels/label ne null

Below are incorrect examples where the query is executed on the PicklistOption entity directly:

  • $filter=assessmentStatus eq '381'
  • $filter=assessmentStatus ne null

Keywords

Failed to retrieve result with given criteria. RCM, Picklist, Odata, filter, report, filterable, sortable, COE_GENERAL_SERVER_FAILURE, COE0019 , KBA , LOD-SF-RCM-API , Webservices & APIs , LOD-SF-INT-API , API & Adhoc API Framework , Problem

Product

SAP SuccessFactors Recruiting all versions