Wednesday, February 19, 2025

Validate product from Retail Assortment in D365FO X++

Public boolean SAN_validateProductAssortment(Str    _itemId)

{

    RetailAssortmentTable           retailAssortmentTable;

    RetailChannelAssortedProductView  retailChannelAssortedProductView;

    InventTable                       inventTable;

    while select  retailAssortmentTable

    {

            select firstonly retailChannelAssortedProductView

                 exists join inventTable

                where inventTable.ItemId == _itemId

                  && retailChannelAssortedProductView.AssortmentRecId == retailAssortmentTable.RecId

                  && retailChannelAssortedProductView.ProductID == inventTable.Product

                  && retailChannelAssortedProductView.InventLocationDataAreaId == inventTable.DataAreaId;

            if(retailChannelAssortedProductView)

            {

                return true;

            }

        }


    }

    throw Error("Invalid item to sell based on assortments");

Disabling the flight in D365FO (CHD - Tier 1)

 INSERT INTO dbo.SYSFLIGHTING(FLIGHTNAME, ENABLED)  VALUES ('<FlightObjectName>_KillSwitch', 1)  or  INSERT INTO dbo.SYSFLIGHT...