Sunday, June 14, 2015

Cancel SO , Return order as Open Order and Picked and delivered in X++

//Cancel SO
-->Open Order in X++

private void toCancelSo()
{
    //info(strFmt("%1 -- %2 ",transDate,salesOrder));
    Query                   query;
    QueryBuildDataSource    qbds;
    QueryBuildRange         qbrSalesId,qbrDate;
    QueryRun                qr;
    InventTrans             inventTrans;
    InventMovement          inventMovement;
    InventTransWMS_Pick     inventTranspick;
    TmpInventTransWMS       TmpInventTransWMS;
    ;
    query = new query();
    qbds= query.addDataSource(tableNum(SalesTable));
    qbds.addRange(fieldNum(SalesTable,SalesType)).value("Sales Order");
    if (transDate != dateNull())
    {
        qbds.addRange(fieldNum(SalesTable,ShippingDateRequested)).value(SysQuery::range(dateNull(),transDate));
    }
    //qbds.addRange(fieldNum(SalesTable,CustAccount)).value("R0003");
    if (salesOrder != "")
    {
        qbrSalesId = qbds.addRange(fieldNum(SalesTable,SalesId));
        qbrSalesId.value(salesOrder);
    }
    qr = new QueryRun(query);
    while(qr.next())
    {
        salesTable = qr.get(tableNum(SalesTable));

        ttsBegin;
        while select forupdate salesLine
                where salesLine.SalesId == salesTable.SalesId
                    && salesLine.SalesStatus == SalesStatus::Backorder
        {
            inventTrans = InventTrans::findTransId(salesLine.InventTransId);
            if (!inventTrans)
            {
                salesLine.RemainInventPhysical = 0;
                salesLine.RemainSalesPhysical  = 0;
                salesLine.update();
            }
            else if(inventTrans.StatusIssue == StatusIssue::OnOrder
                    || inventTrans.StatusIssue == StatusIssue::ReservOrdered
                    || inventTrans.StatusIssue == StatusIssue::ReservPhysical
                    || inventTrans.StatusIssue == StatusIssue::None)
            {
                    salesLine.RemainInventPhysical = 0;
                    salesLine.RemainSalesPhysical  = 0;
                    salesLine.update();
            }

        }
        ttsCommit;
    }
}

/*

Identifying the Status of a Line

if(salesLine.remainSalesFinancial != 0)
{
    // I am delivered
}

or

if(invnetTrans.statusIssue == StatusIssue::Deducted)
{
    // I am delivered
}

if(inventTrans.statusIssue == StatusIssue::Picked)
{
    // I am Picked
}

cancel Status as deleivered

ttsbegin;
salesLine = SalesLine::find(_salesID, _lineNum, true);
 
salesLine.SalesDeliverNow   = -1;
salesLine.setInventDeliverNow();
salesLine.doUpdate();
salesFormLetter = SalesFormLetter::construct(DocumentStatus::PackingSlip);
salesFormLetter.progressHide();                                
 
salesFormLetter.update(salesTable,                           
                       SystemDateGet(),                      
                       SalesUpdate::DeliverNow,              
                       AccountOrder::None,                 
                       false,                             
                       false);                            
ttsCommit;


cancel Status as Picked 

ttsBegin;
salesLine       = salesLine::find(_salesID, _lineNum, true);
inventMovement  = InventMovement::construct(salesLine);
inventTranspick = new InventTransWMS_Pick(inventMovement,tmpInventTransWMS);
 
TmpInventTransWMS.clear();
TmpInventTransWMS.initFromInventTrans(inventTrans::findTransId(salesLine.InventTransId));
TmpInventTransWMS.LineNum     = _LineNum;
TmpInventTransWMS.InventDimId = InventTrans::findTransId(salesLine.InventTransId).InventDimId;
TmpInventTransWMS.InventQty   = ( ABS( InventTrans::findTransId(salesLine.InventTransId).Qty ) * -1 );
TmpInventTransWMS.insert();
 
if( TmpInventTransWMS.InventQty != 0 )
{
    if( inventTranspick.validateTmp(TmpInventTransWMS) )
    {
        InventTransWMS_Pick::updateInvent(inventTranspick,TmpInventTransWMS);
    }
}
 
//cancel order
salesLine.RemainSalesPhysical = 0;
salesLine.remainInventPhysical = 0;
salesLine.update();
ttsCommit;

Cancel a Return Order in AX


    SalesLine       returnLine;
    SalesTable      returnTableUpdate;
    Counter         numberOfRecords;
    SalesTable      salesTable;
    PurchTable      purchTable;
    PurchLine       purchLine;
    ;
 
    ttsbegin;
 
        if (_returnTable.ReturnStatus == ReturnStatusHeader::Created && !_returnTable.existRegisteredReceivedInvoicedLines() && !_returnTable.type().interCompanyIsDerivedOrder())
        {
            while select forupdate returnLine
                  where returnLine.SalesId == _returnTable.SalesId
                  &&    returnLine.InventTransId
            {
                if (returnLine.interCompanySalesLineExist())
                {
                    purchLine            = PurchLine::findInventTransId(returnLine.InventRefTransId,true);
                    purchTable           = PurchTable::find(purchLine.PurchId);
 
                    purchLine.SkipUpdate = InterCompanySkipUpdate::Internal;
                    purchLine.delete(false);
 
                    if (!purchTable.existPurchLine())
                    {
                        if (purchTable.InterCompanyCompanyId
                        &&  purchTable.InterCompanySalesId)
                        {
                            changecompany(purchTable.InterCompanyCompanyId)
                            {
                                salesTable = null;
                                salesTable = SalesTable::find(purchTable.InterCompanySalesId,true);
                                if (salesTable)
                                    salesTable.delete();
                            }
                        }
                    }
                }
 
                returnLine.SalesQty     = 0;
                returnLine.salesQtyModified();
                returnLine.DeliveryType = TradeLineDlvType::None;
                returnLine.SkipUpdate   = InterCompanySkipUpdate::Internal;
                returnLine.update();
            }
 
            returnLine.skipDataMethods(true);
            update_recordset returnLine
            setting     ReturnStatus         = ReturnStatusLine::Canceled,
                        CostPrice            = 0,
                        InventTransIdReturn  = '',
                        SalesStatus          = SalesStatus::Canceled,
                        ReturnClosedDate     = systemdateget()
            where returnLine.SalesId == _returnTable.SalesId;
 
            returnTableUpdate = SalesTable::find(_returnTable.SalesId, true);
            returnTableUpdate.ReturnStatus               = ReturnStatusHeader::Canceled;
            returnTableUpdate.SalesStatus                = SalesStatus::Canceled;
            returnTableUpdate.InterCompanyDirectDelivery = false;
            returnTableUpdate.update();
        }
 
    ttscommit;

*/

Cancel Purchase Order in x++

// Cancel Purchase Order
--> Open order Purchase order line
-->Partial Product Receipt  line also through x++

private void toCancelPo()
{
    //info(strFmt("%1 -- %2 ",transDate,purchaseOrder));
    Query                   query;
    QueryBuildDataSource    qbds;
    QueryBuildRange         qbrPurchId,qbrDate;
    QueryRun                qr;
    List _list = New List(Types::String);
    ListIterator    lt;
    str 100 PurchNumber;
    ;

    query = new query();
    qbds= query.addDataSource(tableNum(PurchTable));
    qbds.addRange(fieldNum(PurchTable,PurchaseType)).value("Purch");
    qbds.addRange(fieldNum(PurchTable,PurchStatus)).value("Backorder");
    if (transDate != dateNull())
    {
        qbds.addRange(fieldNum(PurchTable,CreatedDateTime)).value(SysQuery::range(fromdate,transDate));
    }
    //info(strFmt("%1 -- %2 -- %3",fromdate,transDate,purchaseOrder));
    //qbds.addRange(fieldNum(PurchTable,OrderAccount)).value("R0003");
    if (purchaseOrder != "")
    {
        _list = Global::strSplit(purchaseOrder,";");
        lt = new ListIterator(_list);
        while(lt.more())
        {
            purchNum += lt.value();
            lt.next();
        }
        for(i = 0; i<= conLen(purchNum);i++)
        {
            PurchNumber = conPeek(purchNum,i);
            qbds.addRange(fieldNum(PurchTable,PurchId)).value(PurchNumber);
        }
    }
    qr = new QueryRun(query);
    while(qr.next())
    {
        purchTable = qr.get(tableNum(PurchTable));
        ttsBegin;
        while select forupdate purchLine
                where purchLine.PurchId == purchTable.PurchId
                    && purchLine.PurchStatus == PurchStatus::Backorder
            join inventTrans
                    join inventTransOrigin
                where inventTransOrigin.RecId         ==  inventTrans.InventTransOrigin
                    && inventTransOrigin.InventTransId == purchLine.InventTransId
        {
                //while select
                //{
                    if(inventTrans.StatusReceipt == StatusReceipt::Ordered)
                    {
                        //purchLine.selectForUpdate(true);
                        purchLine.RemainInventPhysical = 0.00;
                        purchLine.RemainPurchPhysical  = 0.00;
                        purchLine.reread();
                        purchLine.update();
                        InventMovement::bufferSetRemainQty(purchLine);
                    }
               // }
            }
        ttsCommit;
    }
}

Receive and ship a transfer order through X++

// Receive and ship a transfer order through X++

private void toCancelTo()
{
    //info(strFmt("%1 -- %2 ",transDate,Transferid));
    Query                   query;
    QueryBuildDataSource    qbds;
    QueryBuildRange         qbrtransId,qbrDate;
    QueryRun                qr;
    ;
    query = new query();
    qbds= query.addDataSource(tableNum(InventTransferTable));
    if(transDate != dateNull())
    {
        qbds.addRange(fieldNum(InventTransferTable,CreatedDateTime)).value(SysQuery::range(dateNull(),transDate));
    }
    //qbds.addRange(fieldNum(SalesTable,CustAccount)).value("R0003");
    if (Transferid != "")
    {
        qbrtransId = qbds.addRange(fieldNum(InventTransferTable,Transferid));
        qbrtransId.value(Transferid);
    }
    qr = new QueryRun(query);
    while(qr.next())
    {
        transferTable = qr.get(tableNum(InventTransferTable));

        ttsBegin;
        while select forupdate transferLine
                where transferLine.Transferid == transferTable.Transferid
        {
            //FUAE-000770
            if (transferLine.QtyRemainShip >= 0.00)
            {
                transferLine.QtyRemainShip = 0.00; //Status shipped
                transferLine.QtyRemainReceive = 0.00; // Status Receive
             
                transferLine.update();
                InventMovement::bufferSetRemainQty(transferLine);
            }

        }
        ttsCommit;
    }
}

Sample UI builder class with multi select lookup based on other filter

// UI builder Sample 
--> all lookup as Multi Select
--> Based on legal entity PurchaseOrder Number will return for selected Legalentities
--> Based One multiple select lookup another multiselect lookup will appear
example here :
Based on 
--> Brand dialog ,category value appear based on brand names..


public class  FulFillmentUIBuilder extends SrsReportDataContractUIBuilder
{
    DialogField                 dialogBrand;
    DialogField                 dialogLegalEntiy;
    DialogField                 dialogWarehouse;
    DialogField                 dialogMAFFSeason;
    DialogField                 dialogBrandSeason;
    DialogField                 dialogCategory;
    DialogField                 dialogdivision;
    DialogField                 dialogGroup;
    DialogField                 dialogsubGroup;
    DialogField                 dialogpurchId;
    //FulfillmentContract  contract;
}

public void Brand(FormStringControl _control)
{
    Query query = new Query();
    QueryBuildDataSource DS;
    Container  cont;

    DS = query.addDataSource(tableNum(EcoResCategory));
    DS.addRange(fieldNum(EcoResCategory,Level)).value('3');
    DS.addSelectionField(fieldNum(EcoResCategory,Name));
    SysLookupMultiSelectGrid::lookup(query,_control,_control,cont);

}

public void BrandSeason(FormStringControl _control)
{
    Query query = new Query();
    QueryBuildDataSource DS;
    Container  cont;

    DS = query.addDataSource(tableNum(SupplementaryHierarchy));
    DS.addSelectionField(fieldNum(SupplementaryHierarchy,BrandSeason));
    DS.addGroupByField(fieldNum(SupplementaryHierarchy,BrandSeason));
    SysLookupMultiSelectGrid::lookup(query,    _control,_control,cont);
}

/// <summary>
/// Builds the UI of the repor input dialog
/// </summary>
/// <remarks>
/// This remark has been overriddento build two nested groups that have a radio button style
/// </remarks>
public void build()
{
    FulfillmentContract  contract;
    super();
    contract = this.dataContractObject()as   FulfillmentContract;

    dialogBrand         = this.bindInfo().getDialogField(contract,methodStr(  FulfillmentContract,parmBrand));
    dialogLegalEntiy    = this.bindInfo().getDialogField(contract,methodStr(  FulfillmentContract,parmLegalEntity));
    dialogWarehouse     = this.bindinfo().getDialogField(contract,methodStr(  FulfillmentContract,parmWarehouse));
    dialogMAFFSeason    = this.bindInfo().getDialogField(contract,methodStr(  FulfillmentContract,parmMAFFSeason));
    dialogBrandSeason   = this.bindInfo().getDialogField(contract,methodStr(  FulfillmentContract,parmBrandSeason));
    dialogCategory      = this.bindInfo().getDialogField(contract,methodStr(  FulfillmentContract,parmcategory));
    dialogdivision      = this.bindInfo().getDialogField(contract,methodStr(  FulfillmentContract,parmDivision));
    dialogGroup         = this.bindInfo().getDialogField(contract,methodStr(  FulfillmentContract,parmGroup));
    dialogsubGroup      = this.bindInfo().getDialogField(contract,methodStr(  FulfillmentContract,parmsubGroup));
    dialogpurchId       = this.bindInfo().getDialogField(contract,methodstr(  FulfillmentContract,parmpurchid));

}

public void Category(FormStringControl _control,Container _cont)
{
    Query query = new Query();
    List _list = New List(Types::String);
    ListIterator    lt;
    int i;
    QueryBuildDataSource DS;
    Container  cont,contBrand;
    str brandname;
    str 100 brandFilterName;
    EcoResCategory ecoresCategory,ecorescat;

    DS = query.addDataSource(tableNum(EcoResCategory));
    //info(strFmt("%1",dialogBrand.value()));
    brandname = dialogBrand.value();
    if(brandname !="")
    {
        _list = Global::strSplit(brandname,";");
        lt = new ListIterator(_list);
        while(lt.more())
        {
            contBrand += lt.value();
            lt.next();
        }
        for(i = 1;i <= conLen(contBrand);i++)
        {
            //info(strFmt("%1",conPeek(contBrand,i)));
            brandFilterName = conPeek(contBrand,i);
            Select ecorescategory where ecorescategory.Name == brandFilterName;
            while select ecorescat where ecorescat.ParentCategory == ecorescategory.RecId
            {
                //info(strFmt("%1",ecorescat.Name));
                DS.addRange(fieldNum(EcoResCategory,Name)).value(ecorescat.Name);
            }

        }
        DS.addSelectionField(fieldNum(EcoResCategory,Name));
        SysLookupMultiSelectGrid::lookup(query,_control,_control,_cont);
    }
    else
    {
        DS.addRange(fieldNum(EcoResCategory,Level)).value('4');
        DS.addSelectionField(fieldNum(EcoResCategory,Name));
        SysLookupMultiSelectGrid::lookup(query, _control,_control,_cont);
    }
}

public void Division(FormStringControl _control)
{
    Query query = new Query();
    List _list = New List(Types::String);
    ListIterator    lt;
    int i;
    QueryBuildDataSource DS;
    Container  cont,contCat;
    str CatName;
    str 100 CatFilterName;
    EcoResCategory ecoresCategory,ecorescat;

    DS = query.addDataSource(tableNum(EcoResCategory));
    //info(strFmt("%1",dialogCategory.value()));
    CatName = dialogCategory.value();
    if(CatName !="")
    {
        _list = Global::strSplit(CatName,";");
        lt = new ListIterator(_list);
        while(lt.more())
        {
            contCat += lt.value();
            lt.next();
        }
        for(i = 1;i <= conLen(contCat);i++)
        {
            //info(strFmt("%1",conPeek(contBrand,i)));
            CatFilterName = conPeek(contCat,i);
            Select ecorescategory where ecorescategory.Name == CatFilterName;
            while select ecorescat where ecorescat.ParentCategory == ecorescategory.RecId
            {
                //info(strFmt("%1",ecorescat.Name));
                DS.addRange(fieldNum(EcoResCategory,Name)).value(ecorescat.Name);
            }

        }
        DS.addSelectionField(fieldNum(EcoResCategory,Name));
        SysLookupMultiSelectGrid::lookup(query,    _control,_control,cont);
    }
    else
    {
        DS.addRange(fieldNum(EcoResCategory,Level)).value('5');
        DS.addSelectionField(fieldNum(EcoResCategory,Name));
        SysLookupMultiSelectGrid::lookup(query,    _control,_control,cont);
    }
}

public void GroupCat(FormStringControl _control)
{
    Query query = new Query();
    List _list = New List(Types::String);
    ListIterator    lt;
    int i;
    QueryBuildDataSource DS;
    Container  cont,contCat;

    str 100 GroupFilterName;
    EcoResCategory ecoresCategory,ecorescat;

    DS = query.addDataSource(tableNum(EcoResCategory));
    //info(strFmt("%1",dialogCategory.value()));
    GroupFilterName = dialogdivision.value();
    if(GroupFilterName !="")
    {
        _list = Global::strSplit(GroupFilterName,";");
        lt = new ListIterator(_list);
        while(lt.more())
        {
            contCat += lt.value();
            lt.next();
        }
        for(i = 1;i <= conLen(contCat);i++)
        {
            //info(strFmt("%1",conPeek(contBrand,i)));
            GroupFilterName = conPeek(contCat,i);
            Select ecorescategory where ecorescategory.Name == GroupFilterName;
            while select ecorescat where ecorescat.ParentCategory == ecorescategory.RecId
            {
                //info(strFmt("%1",ecorescat.Name));
                DS.addRange(fieldNum(EcoResCategory,Name)).value(ecorescat.Name);
            }

        }
        DS.addSelectionField(fieldNum(EcoResCategory,Name));
        SysLookupMultiSelectGrid::lookup(query,    _control,_control,cont);
    }
    else
    {
        DS.addRange(fieldNum(EcoResCategory,Level)).value('6');
        DS.addSelectionField(fieldNum(EcoResCategory,Name));
        SysLookupMultiSelectGrid::lookup(query,    _control,_control,cont);
    }
}

public void LegalEntity(FormStringControl _control)
{
    //Query query = new Query(queryStr(Query5));
    Query query = new Query();
    QueryBuildDataSource DS;
    Container  cont;

    DS = query.addDataSource(tableNum(DataArea));
    DS.addSelectionField(fieldNum(DataArea,Id));
    DS.addSelectionField(fieldNum(DataArea,Name));
    SysLookupMultiSelectGrid::lookup(query, _control,_control,cont);
}

public void MAFFBrandSeason(FormStringControl _control,Container _cont)
{
    Query query = new Query();
    QueryBuildDataSource DS;
    Container  cont;

    DS = query.addDataSource(tableNum(RetailSeasonTable));
    DS.addSelectionField(fieldNum(RetailSeasonTable,SeasonCode));
    SysLookupMultiSelectGrid::lookup(query,    _control,_control,cont);
}

public void postBuild()
{
    super();

    dialogCategory = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(  FulfillmentContract,parmcategory));
    dialogCategory.registerOverrideMethod(methodStr(FormStringControl, lookup),methodStr(  FulFillmentUIBuilder,Category),this);

    dialogDivision = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(  FulfillmentContract,parmDivision));
    dialogDivision.registerOverrideMethod(methodStr(FormStringControl, lookup),methodStr(  FulFillmentUIBuilder,Division),this);

    dialogGroup = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(  FulfillmentContract,parmGroup));
    dialogGroup.registerOverrideMethod(methodStr(FormStringControl, lookup),methodStr(  FulFillmentUIBuilder,GroupCat),this);

    dialogsubGroup = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(  FulfillmentContract,parmSubGroup));
    dialogsubGroup.registerOverrideMethod(methodStr(FormStringControl, lookup),methodStr(  FulFillmentUIBuilder,SubGroup),this);
}

public void postRun()
{
    super();

    dialogBrand.registerOverrideMethod(methodStr(FormStringControl, lookup),methodStr(  FulFillmentUIBuilder, Brand),this);
    dialogWarehouse.registerOverrideMethod(methodStr(FormStringControl, lookup),methodStr(  FulFillmentUIBuilder,Warehouse),this);
    dialogLegalEntiy.registerOverrideMethod(methodStr(FormStringControl, lookup),methodStr(  FulFillmentUIBuilder,LegalEntity),this);
    dialogPurchId.registerOverrideMethod(methodStr(FormStringControl, lookup),methodStr(  FulFillmentUIBuilder, PurchaseOrder),this);
    dialogMAFFSeason.registerOverrideMethod(methodStr(FormStringControl, lookup),methodStr(  FulFillmentUIBuilder, MAFFBrandSeason),this);
    dialogBrandSeason.registerOverrideMethod(methodStr(FormStringControl, lookup),methodStr(  FulFillmentUIBuilder, BrandSeason),this);
}

public void PurchaseOrder(FormStringControl _control,Container _cont)
{
    Query query = new Query();
    QueryBuildDataSource DS;
    List _list = New List(Types::String);
    ListIterator    lt;
    PurchTable  purchTable,purchtab;
    int i,j,k,l;
    str 100 LegalEntity,conlegal,conlegalTo,conPurch;
    container con,conlegalEntity;
      POLookup   POLookup;
    if (dialogLegalEntiy.value() == "")
    {
        checkFailed("Legal Entity Must be filled In");
    }
    else
    {
        delete_from   POLookup;
        LegalEntity = dialogLegalEntiy.value();
        _list = Global::strSplit(LegalEntity,";");
        lt = new ListIterator(_list);
        while(lt.more())
        {
            con += lt.value();
            lt.next();
        }
        for(i = 1;i <= conLen(con);i++)
        {
            conlegal = conPeek(con,i);
            if (conlegal == curext())
            {
                while select purchtab where purchtab.dataAreaId == conlegal
                {
                    conlegalEntity += purchtab.PurchId;
                }
                purchtab.clear();
            }
            else
            {
                changeCompany(conlegal)
                {
                    while select purchTable where purchTable.dataAreaId == conlegal
                    {
                        conlegalEntity += purchTable.PurchId;
                    }
                    purchTable.clear();
                }
            }
        }
        for(k = 1;k <= conLen(conlegalEntity);k++)
        {
            conPurch = conPeek(conlegalEntity,k);
              POLookup.PurchaseOrder = conPurch;
            //  POLookup.CompanyName = conlegalTo;
              POLookup.insert();
        }
        DS = query.addDataSource(tableNum(  POLookup));
        DS.addSelectionField(fieldNum(  POLookup,PurchaseOrder));
        //DS.addSelectionField(fieldNum(  POLookup,CompanyName));
        SysLookupMultiSelectGrid::lookup(query,    _control,_control,_cont);
    }
}

public void SubGroup(FormStringControl _control)
{
    Query query = new Query();
    List _list = New List(Types::String);
    ListIterator    lt;
    int i;
    QueryBuildDataSource DS;
    Container  cont,contCat;
    str CatName;
    str 100 CatFilterName;
    EcoResCategory ecoresCategory,ecorescat;

    DS = query.addDataSource(tableNum(EcoResCategory));
    //info(strFmt("%1",dialogGroup.value()));
    CatName = dialogGroup.value();
    if(CatName !="")
    {
        _list = Global::strSplit(CatName,";");
        lt = new ListIterator(_list);
        while(lt.more())
        {
            contCat += lt.value();
            lt.next();
        }
        for(i = 1;i <= conLen(contCat);i++)
        {
            //info(strFmt("%1",conPeek(contBrand,i)));
            CatFilterName = conPeek(contCat,i);
            Select ecorescategory where ecorescategory.Name == CatFilterName;
            while select ecorescat where ecorescat.ParentCategory == ecorescategory.RecId
            {
                //info(strFmt("%1",ecorescat.Name));
                DS.addRange(fieldNum(EcoResCategory,Name)).value(ecorescat.Name);
            }

        }
        DS.addSelectionField(fieldNum(EcoResCategory,Name));
        SysLookupMultiSelectGrid::lookup(query,    _control,_control,cont);
    }
    else
    {
        DS.addRange(fieldNum(EcoResCategory,Level)).value('7');
        DS.addSelectionField(fieldNum(EcoResCategory,Name));
        SysLookupMultiSelectGrid::lookup(query,    _control,_control,cont);
    }
}

public void Warehouse(FormStringControl _control)
{
    Query query = new Query();
    QueryBuildDataSource DS;
    Container  cont;

    DS = query.addDataSource(tableNum(InventLocation));
    DS.addSelectionField(fieldNum(InventLocation,InventLocationId));
    DS.addSelectionField(fieldNum(InventLocation,Name));
    SysLookupMultiSelectGrid::lookup(query,    _control,_control,cont);
}


Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...