Thursday, 27 October 2016

Scenario: In Purchase order listpage, we should get selected PO’s respective purchase lines by clicking a button in action pane.

NOTE: When we click on button, PO details should get moved to class and line details form should get open from that class itself.

è Create a class which to get selected PO details.

è In Class main() :
public static void main(Args _args)
{

    PurchTable purchTable;
    FormRun formRun ;

    purchTable = _args.record();

    if(purchTable.DocumentState == VersioningDocumentState::Approved)
    {
        _args.name(formStr(purchTable));
        formRun = classFactory.formRunClass(_args);
        formRun.init();
        formRun.run();
        formRun.wait();
    }
    else
    {
        info("Purchase order is not approved");
    }


}

è In ‘PurchTableListPage’ action pane add a button .

è

è Set button properties as :
o   DisplayTarget : Client
o   Text  : SalesLines
è In button à clicked()
void clicked()
{
    PurchTable            purchTable;
    MenuFunction          mf;
    Args    args = new Args();

    args.record(purchaseTable);
    mf = new   MenuFunction(menuitemActionStr(PO_Details),MenuItemType::Action);
    mf.run(args);

}

è If we want line details in our customized form, we should pass args data from class to form datasource init() like below.

public void init()
{
    Query query;
    QueryBuildDataSource qbds;
    QueryBuildRange  qbr;

    super();


    //info(purchtable.PurchId);
    if(element.args().record())
    {
        purchtable =  element.args().record();
        if(PurchTable.PurchId == PurchLine.PurchId)
        {
            query = new Query();
            qbr = query.addDataSource(tablenum(PurchLine)).addRange(fieldnum(PurchLine, PurchId));
            qbr.value(purchtable.PurchId);
            PurchLine_ds.query(query);
        }


    }


}


No comments:

Post a Comment