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.:
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"> |
If you are a Partner go to Provisioning > Configure Reportable Custom fields and add the field definition to reportable custom fields, e.g.:
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