1

Hi I am trying custom graphql call using dxa apis

i am calling this line

InputItemFilter inputItemFilter = new InputItemFilter();
inputItemFilter.setCustomMeta(customMetaCriteria);
InputSortParam inputSortParam = new InputSortParam();
inputSortParam.setSortBy(SortFieldType.LAST_PUBLISH_DATE);

ItemConnection itemConnection = getPcaClient().executeItemQuery(inputItemFilter,
                inputSortParam, new Pagination(), "",
                ContentIncludeMode.INCLUDE_DATA, false, null);

but i am getting error

"errorType": "ValidationError",             
"extensions": null,             
"message": "Variable 'inputSortParam' has coerced Null value for NonNull type 'SortOrderType!'",            
"path": null,           
"suppressed": [],           
"localizedMessage": "Variable 'inputSortParam' has coerced Null value for NonNull type 'SortOrderType!'"

or is there any method where i can only pass filter and get the respected output.

Could someone please advise what i am missing here.

  • added InputSortParam inputSortParam = new InputSortParam(); inputSortParam.setOrder(SortOrderType.Ascending); inputSortParam.setSortBy(SortFieldType.ITEM_ID); this fixed the problem – Neetesh Narvaria Apr 17 at 12:46
  • 1
    Good to see you found the problem. Please consider answering your own question with the solution with some explanation of what was wrong. This can help others (and even yourself in the future) who have a similar issue in the future. You can choose to post as a community answer or accept your own answer, though it's good to give others a chance to answer as well, in case someone has a correct answer with additional context that you prefer over your own. :-) – Alvin Reyes Apr 19 at 8:11
  • sure @AlvinReyes, i'll add this as answer thanks :) – Neetesh Narvaria Apr 20 at 6:14
3

added

InputSortParam inputSortParam = new InputSortParam();
inputSortParam.setOrder(SortOrderType.Ascending);
inputSortParam.setSortBy(SortFieldType.LAST_PUBLISH_DATE);

this fixed the problem. based on error i figured out both fields order and sortBy on are required InputSortParam.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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