forcedotcom / forcedotcom/b2b-commerce-on-lightning-quickstart
Commerce Search Refinement doesn't work with picklist fields
- Dominant language
- Shell
- Stars
- 191
- Forks
- 211
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I am implementing commerce search using Connect API
[Rest Connect API](https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_commerce_webstore_product_search.htm)
[Apex Connect API](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_CommerceSearch_static_methods.htm#apex_ConnectAPI_CommerceSearch_productSearch_1)
Unfortunately I cannot filter search results by picklist field value.
B2B Commerce on Lightning Doc states that picklist type is supported.
This is a sample of my code:
`
CommerceSearchDomain.SearchProductsWrapper searchProductsWrapper = new CommerceSearchDomain.SearchProductsWrapper();
searchProductsWrapper.webstoreId = input.webstoreId;
searchProductsWrapper.productSearchInput = new ConnectApi.ProductSearchInput();
searchProductsWrapper.productSearchInput.pageSize = APP_CommerceCatalogAPI.DEFAULT_SEARCH_PRODUCTS_SIZE;
searchProductsWrapper.productSearchInput.page = input.pageNumber;
searchProductsWrapper.productSearchInput.searchTerm = input.searchTerm;
ConnectApi.DistinctValueRefinementInput refinementInput = new ConnectApi.DistinctValueRefinementInput();
refinementInput.values = new List{'HE'};
refinementInput.nameOrId = 'Orders_3__c';
refinementInput.type = ConnectApi.CommerceSearchFacetType.DistinctValue;
refinementInput.attributeType = ConnectApi.CommerceSearchAttributeType.Custom;
searchProductsWrapper.productSearchInput.refinements = new List{refinementInput};
`
Picklist field values:

Running SOQL as B2B user returns Product records with correct value in specified field.
But commerce search returns an empty response whenever I try to specify value in Refinement. For empty refinements list it returns every record (accessible by user).
I tried to check other fields and using Checkbox field gives proper results from the Webstore Search.
Before using fields as search filters I configure commerce setup and rebuild search index

Any ideas what is missing in my code or configuration? Anyone had this issue before?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.