Search Results for

    Show / Hide Table of Contents

    Extending Find Items

    Find Items is a useful functionality in COSMO Mobile Solution to check inventory by various properties such as Lot No., Variant Code, Expiration Date, and so on. This feature can be extended with additional fields if it arises as a customer requirement.

    Background

    The Find Items feature is based on two summary tables:

    • "CCS MS Item LE Summary": Contains the actual cumulative inventory by location based on the contents of the "Item Ledger Entry" table.
    • "CCS MS Whse Entry Summary": Contains the actual cumulative inventory by location/bin based on the contents of the "Warehouse Entry" table.

    These two tables are the sources of the search. The configuration of the Find Items feature consists of a filter page (CCSMSFindItemsWS (5307932)) and a result page (CCSMSFindItemsResultWS (5308065)). On the filter page, it's possible to provide parameters, based on which the search will be performed. The result page contains the inventory records that were calculated according to the filters.

    The Find Items feature uses a helper table containing the search result dataset named "CCS MS Find Item".

    Extend Source Tables and Result Set with Custom Fields

    In this example, there are some extra fields to calculate quantities: "MYEXT Basic Quantity" and "MYEXT Quantity Multiplier". Additionally, there is an extra internal item identifier: "MYEXT Secondary Item ID". Populating these fields should be a part of the customer's own business logic. Assume that these fields are populated by the customer's specific extension in the "Item Ledger Entry" and "Warehouse Entry" tables, as well as in the "Item" table.

    Extend Source Tables and Result Set

    1. The three tables described above should be extended with extra fields if they're required in the Find Items functionality. The names of the extra fields should be the same in all affected tables.

      namespace MyExtension.Inventory.Ledger;
      
      using CosmoConsult.MobileSolution.BusinessLogic.Inventory.Ledger;
      
      tableextension 50000 "MYEXT Item LE Summary" extends "CCS MS Item LE Summary"
      {
          fields
          {
              field(50000; "MYEXT Secondary Item ID"; Code[100])
              {
                  DataClassification = CustomerContent;
                  Caption = 'Secondary Item ID';
              }
      
              field(50001; "MYEXT Basic Quantity"; Decimal)
              {
                  DataClassification = CustomerContent;
                  Caption = 'Basic Quantity';
              }
      
              field(50002; "MYEXT Quantity Multiplier"; Decimal)
              {
                  DataClassification = CustomerContent;
                  Caption = 'Quantity Multiplier';
              }
          }
      }
      
      namespace MyExtension.Inventory.Ledger;
      
      using CosmoConsult.MobileSolution.BusinessLogic.Inventory.Ledger;
      
      tableextension 50001 "MYEXT Item LE Summary" extends "CCS MS Whse Entry Summary"
      {
          fields
          {
              field(50000; "MYEXT Secondary Item ID"; Code[100])
              {
                  DataClassification = CustomerContent;
                  Caption = 'Secondary Item ID';
              }
      
              field(50001; "MYEXT Basic Quantity"; Decimal)
              {
                  DataClassification = CustomerContent;
                  Caption = 'Basic Quantity';
              }
      
              field(50002; "MYEXT Quantity Multiplier"; Decimal)
              {
                  DataClassification = CustomerContent;
                  Caption = 'Quantity Multiplier';
              }
          }
      }
      
      namespace MyExtension.Inventory.Ledger;
      
      using CosmoConsult.MobileSolution.BusinessLogic.Inventory.Ledger;
      
      tableextension 50002 "MYEXT Item LE Summary" extends "CCS MS Find Item"
      {
          fields
          {
              field(50000; "MYEXT Secondary Item ID"; Code[100])
              {
                  DataClassification = CustomerContent;
                  Caption = 'Secondary Item ID';
              }
      
              field(50001; "MYEXT Basic Quantity"; Decimal)
              {
                  DataClassification = CustomerContent;
                  Caption = 'Basic Quantity';
              }
      
              field(50002; "MYEXT Quantity Multiplier"; Decimal)
              {
                  DataClassification = CustomerContent;
                  Caption = 'Quantity Multiplier';
              }
          }
      }
      
    2. After defining the fields, they should be populated using the following subscription points.

      namespace MyExtension.Inventory.Ledger;
      
      using Microsoft.Inventory.Item;
      using Microsoft.Inventory.Ledger;
      using Microsoft.Warehouse.Ledger;
      using CosmoConsult.MobileSolution.BusinessLogic.Inventory.Ledger;
      
      codeunit 50000 "MYEXT Find Item Summary"
      {
          Permissions =
              tabledata "CCS MS Item LE Summary" = rm,
              tabledata "CCS MS Whse Entry Summary" = rm,
              tabledata "Warehouse Entry" = r,
              tabledata "Item Ledger Entry" = r;
      
          [EventSubscriber(ObjectType::Codeunit, Codeunit::"CCS MS Find Item Summary", 'OnBeforeLoadFieldsOfItemLedgerEntry', '', false, false)]
          local procedure CCSMSFindItemSummary_OnBeforeLoadFieldsOfItemLedgerEntry(var ItemLedgerEntry: Record "Item Ledger Entry")
          begin
              ItemLedgerEntry.AddLoadFields("MYEXT Secondary Item ID", "MYEXT Basic Quantity", "MYEXT Quantity Multiplier");
          end;
      
          [EventSubscriber(ObjectType::Codeunit, Codeunit::"CCS MS Find Item Summary", 'OnBeforeIncreaseQuantityOfItemLedgerEntrySummary', '', false, false)]
          local procedure CCSMSFindItemSummary_OnBeforeIncreaseQuantityOfItemLedgerEntrySummary(var ItemLedgerEntrySummary: Record "CCS MS Item LE Summary"; ItemLedgerEntry: Record "Item Ledger Entry"; TempItem: Record Item; var IsHandled: Boolean)
          begin
              ItemLedgerEntrySummary."MYEXT Secondary Item ID" := TempItem."MYEXT Secondary Item ID";
              ItemLedgerEntrySummary."MYEXT Basic Quantity" += ItemLedgerEntry."MYEXT Basic Quantity";
              ItemLedgerEntrySummary."MYEXT Quantity Multiplier" := TempItem."MYEXT Quantity Multiplier";
              ItemLedgerEntrySummary.Quantity := ItemLedgerEntrySummary."MYEXT Basic Quantity" * ItemLedgerEntrySummary."MYEXT Quantity Multiplier;
              IsHandled := true;  // it has to be set to TRUE because we changed the standard quantity calculation
          end;
      
          [EventSubscriber(ObjectType::Codeunit, Codeunit::"CCS MS Find Item Summary", 'OnBeforeLoadFieldsOfWarehouseEntry', '', false, false)]
          local procedure CCSMSFindItemSummary_OnBeforeLoadFieldsOfWarehouseEntry(var WarehouseEntry: Record "Item Ledger Entry")
          begin
              WarehouseEntry.AddLoadFields("MYEXT Secondary Item ID", "MYEXT Basic Quantity", "MYEXT Quantity Multiplier");
          end;
      
          [EventSubscriber(ObjectType::Codeunit, Codeunit::"CCS MS Find Item Summary", 'OnBeforeIncreaseQuantityOfWhseEntrySummary', '', false, false)]
          local procedure CCSMSFindItemSummary_OnBeforeIncreaseQuantityOfWhseEntrySummary(var WhseEntrySummary: Record "CCS MS Whse Entry Summary"; WarehouseEntry: Record "Warehouse Entry"; Bin: Record Bin; TempItem: Record Item; var IsHandled: Boolean)
          begin
              WhseEntrySummary."MYEXT Secondary Item ID" := TempItem."MYEXT Secondary Item ID";
              WhseEntrySummary."MYEXT Basic Quantity" += WarehouseEntry."MYEXT Basic Quantity";
              WhseEntrySummary."MYEXT Quantity Multiplier" := TempItem."MYEXT Quantity Multiplier";
              WhseEntrySummary.Quantity := WhseEntrySummary."MYEXT Basic Quantity" * WhseEntrySummary."MYEXT Quantity Multiplier;
              IsHandled := true;  // it has to be set to TRUE because we changed the standard quantity calculation
          end;
      }
      
    3. Extending the published WebService page is also required for displaying the result set of the Find Items feature called "CCS MS Find Items Result WS".

      namespace MyExtension.Inventory.Ledger;
      
      using CosmoConsult.MobileSolution.BusinessLogic.Inventory.Ledger;
      
      pageextension 50000 "MYEXT Find Items Result WS" extends "CCS MS Find Items Result WS"
      {
          layout
          {
              addlast(GroupName)
              {
                  field("MYEXT Secondary Item ID"; Rec."MYEXT Secondary Item ID")
                  {
                      ApplicationArea = All;
                      ToolTip = ' ', Locked = true;  // in the web service interface the tooltips are not used
                  }
      
                  field("MYEXT Basic Quantity"; Rec."MYEXT Basic Quantity")
                  {
                      ApplicationArea = All;
                      ToolTip = ' ', Locked = true;  // in the web service interface the tooltips are not used
                  }
      
                  field("MYEXT Quantity Multiplier"; Rec."MYEXT Quantity Multiplier")
                  {
                      ApplicationArea = All;
                      ToolTip = ' ', Locked = true;  // in the web service interface the tooltips are not used
                  }
              }
          }
      }
      
    4. The next step is to update the configuration on the result set page customization called CCSMSFindItemsResultWS.

      1. Search and open the Mobile Solution Center page.

      2. Choose the Page Customizations tile to open the list of the customizations.

      3. Find and open the CCSMSFindItemsResultWS page customization.

      4. Choose the Refresh Metadata action.

        After this, the newly added fields will be displayed at the bottom of the field list of the Card View FastTab. Visibility and the order of these fields can be configured, as well as be added to the List View FastTab by selecting the target List Part and choosing the Insert New Line action.

    Now, the AL objects and the COSMO Mobile Solution configuration is ready to use the extended result set of the Find Items.

    Additional Information about the Summary Tables

    To utilize additional fields within any built-in features of COSMO Mobile Solution that rely on summary tables – such as Item Tracking, Physical Inventory, Movement, Item Adjustment, and others – the same subscription points and table extensions for the summary tables, as described above, must be implemented.

    Extend Filtering with Custom Fields

    The same setup described above will be used, consisting of two custom quantity-related fields and a custom item identifier. With the extended stock information now implemented, the custom item identifier or custom quantity calculation can be retrieved using the Find Items feature. However, what if it's required to retrieve stock information using the "MYEXT Secondary Item ID" or filter the results by the custom quantity-related fields?

    The solution involves extending the filter page and its source table to include the additional filters, as well as implementing the custom filters within the calculation report.

    Extend Source Table and Filter Page and Implementation of New Filters

    COSMO Mobile Solution uses the general CCS MS Web Service Helper table as a SourceTable to store the user defined filters. So it should be extended or some of the predefined fields can be used. Because every predefined Code type field is by the standard filter page, a new filter field has to be implemented for filtering by the "MYEXT Secondary Item ID" field. The predefined decimal fields are free to use, so they can be used as quantity filters. In this solution, the decimal filter means the minimum amount.

    1. Extend the SourceTable of the filter page (required).

      namespace MyExtension.Mobile.General;
      
      using CosmoConsult.MobileSolution.System.Extensibility
      
      tableextension 50003 "MYEXT Web Service Helper" extends "CCS MS Web Service Helper"
      {
          fields
          {
              field(50000; "MYEXT Secondary Item ID Filter"; Code[250])
              {
                  DataClassification = CustomerContent;
                  Caption = 'Secondary Item ID Filter';
              }
          }
      }
      
    2. Extend the filter card of the Find Items feature.

      namespace MyExtension.Inventory.Ledger
      
      using MyExtension.Mobile.General;
      using CosmoConsult.MobileSolution.BusinessLogic.Inventory.Ledger;
      
      pageextension 50001 "MYEXT Find Items Filter WS" extends "CCS MS Find Items Filter WS"
      {
          layout
          {
              addlast(GroupName)
              {
                  field("MYEXT Secondary Item ID Filter"; Rec."MYEXT Secondary Item ID Filter")
                  {
                      ApplicationArea = All;
                      ToolTip = ' ', Locked = true;  // in the web service interface the tooltips are not used
                  }
      
                  field("MYEXT Basic Quantity"; Rec."Decimal 1")
                  {
                      ApplicationArea = All;
                      Caption = 'Minimum Basic Quantity';
                      ToolTip = ' ', Locked = true;
                  }
              }
          }
      }
      
    3. Extend the CCS MS Find Items processing report to apply the new filters (required).

      namespace MyExtension.Inventory.Ledger
      
      using CosmoConsult.MobileSolution.BusinessLogic.Inventory.Ledger;
      
      reportextension "MYEXT Find Items" extends "CCS MS Find Items"
      {
          dataset
          {
              modify("Warehouse Entry Summary")
              {
                  trigger OnAfterPreDataItem()
                  begin
                      if FindItemsFilters."MYEXT Secondary Item ID Filter" <> '' then
                          "Warehouse Entry Summary".SetFilter("MYEXT Secondary Item ID", FindItemsFilters."MYEXT Secondary Item ID Filter");
                      if FindItemsFilters."Decimal 1" > 0 then
                          "Warehouse Entry Summary".SetFilter("MYEXT Basic Quantity", '>=%1', FindItemsFilters."Decimal 1");
                  end;
              }
      
              modify("Item Ledger Entry Summary")
              {
                  trigger OnAfterPreDataItem()
                  begin
                      if FindItemsFilters."MYEXT Secondary Item ID Filter" <> '' then
                          "Item Ledger Entry Summary".SetFilter("MYEXT Secondary Item ID", FindItemsFilters."MYEXT Secondary Item ID Filter");
                      if FindItemsFilters."Decimal 1" > 0 then
                          "Item Ledger Entry Summary".SetFilter("MYEXT Basic Quantity", '>=%1', FindItemsFilters."Decimal 1");
                  end;
              }
          }
      }
      
    4. Update the configuration of the CCSMSFindItemsFilterWS filter page customization.

      1. Search and open the Mobile Solution Center page.
      2. Choose the Page Customizations tile to open the list of the customizations.
      3. Find and open the CCSMSFindItemsFilterWS page customization.
      4. Choose the Refresh Metadata action.

      After this, the newly added fields will be displayed at the bottom of the field list of the Card View FastTab. Visibility and the order of these fields can be configured, as well as be added to the List View FastTab by selecting the target List Part and choosing the Insert New Line action.



    Feedback
    Submit feedback for this page .

    In This Article
    Back to top 2025 © COSMO CONSULT - Data protection - Imprint