Hi Team,
We are working with BigCommerce connector (build: 23.105). In BigCommerce Stores screen under inventory setting tab, we have Default Stock Categories field (Dropdown field) it loads all item sales categories by default. I want to override this field to load only required categories. We tried with fieldSelecting event but values are not updating in the Default Stock Categories field. Can you please review below details and suggest the best possible way to do that.
Graph:
public class KNBCROBCBigCommerceStoreMaintExt : PXGraphExtension<BCBigCommerceStoreMaint>
{
public static bool IsActive() { return true; }
protected virtual void BCBindingExt_StockSalesCategoriesIDs_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e)
{
BCBindingExt row = e.Row as BCBindingExt;
BCBinding bCBinding = PXSelect<BCBinding, Where<BCBinding.bindingID, Equal<Required<BCBinding.bindingID>>>>.Select(Base, row?.BindingID);
List<string> allowedValues = new List<string>();
List<string> allowedLabels = new List<string>();
INCategory category = PXSelect<INCategory, Where<INCategory.description, Equal<Required<INCategory.description>>>>.Select(Base, bCBinding?.BindingName);
foreach (INCategory categories in PXSelect<INCategory, Where<INCategory.parentID, Equal<Required<INCategory.parentID>>>>.Select(Base, category?.CategoryID))
{
allowedValues.Add(categories.CategoryID.ToString());
allowedLabels.Add(categories.Description.Trim());
}
e.ReturnState = PXStringState.CreateInstance(e.ReturnState, 4000, true, typeof(BCBindingExt.stockSalesCategoriesIDs).Name, false, -1, string.Empty, allowedValues.ToArray(), allowedLabels.ToArray(), true, null);
((PXStringState)e.ReturnState).MultiSelect = true;
}
}
Thank you in Advance!