Hi All,
I have developed a custom load method to extract required data from multiple IDOs. Returned back extracted data in a DataTable. In the response I am always getting empty book mark as shown below. I have given record cap as 10 and I know there are more records to display.
"Bookmark": "<B/>", "MoreRowsExist": false, "Success": true, "Message": null
I even tried to return back LoadCollectionResponseData instead of DataTable.
{ "Items": null, "Bookmark": null, "MoreRowsExist": false, "Success": false, "Message": "Custom load method ue_XX_eCommerceProductsView.Test_GetProducts returned an invalid result [LoadCollectionResponseData].
Here is the sample code I used:
[IDOMethod(MethodFlags.CustomLoad, "Infobar")]
public LoadCollectionResponseData Test_GetProducts(
string CatalogId,
[Optional] ref string Infobar)
{
// 1. Get ORIGINAL request from CSI
var original = this.Context.Request as LoadCollectionRequestData;
try
{
// ---------------------------------------------
// 2. Build a NEW request STARTING FROM original
// ---------------------------------------------
var request = new LoadCollectionRequestData
{
IDOName = "ue_XX_AdobeCommerceProductsView",
// MUST match incoming request or CSI rejects it
PropertyList = original.PropertyList,
// Preserve paging
LoadType = original.LoadType,
Bookmark = original.Bookmark,
RecordCap = original.RecordCap,
EnableBookmark = true,
// Preserve filter & order from caller
Filter = original.Filter,
OrderBy = original.OrderBy
};
// ---------------------------------------------
// 3. Load paged data directly from the IDO
// ---------------------------------------------
var response = this.Context.Commands.LoadCollection(request);
// ---------------------------------------------
// 4. OPTIONAL: enrich response.Items safely
// ---------------------------------------------
int idxViewItem = response.PropertyList.IndexOf("Item");
foreach (IDOItem item in response.Items)
{
string itm = item.PropertyValues[idxViewItem].Value;
MaintainApplicationDebugLog("O",
"ue_NW_AdobeCommerceProductsView",
"Test_GetProducts",
$"Item: {itm}");
}
// ---------------------------------------------
// 5. RETURN the exact response loaded from IDO
// ---------------------------------------------
return response;
}
catch (Exception ex)
{
MaintainApplicationDebugLog("O",
"ue_XX_AdobeCommerceProductsView",
"Test_GetProducts-ERROR",
ex.ToString());
// Return an EMPTY but VALID CSI response
return CreateEmptyPagedResponse(original.PropertyList);
}
}