Monday, February 15, 2016

Display and Edit methods : in ax 2012

Display and Edit methods  Examples:
First Create 3 methods in CustTable as following:

1)
display CustBankAccountId displaybankgroup() // to display bankaccountid
{
    CustBankAccount custBankAccount;
    BankGroup            bankGroup;
   // BankAccountTable bankAccountTable;
    ;

 /*   select accountid from custBankAccount
        where custBankAccount.CustAccount==this.AccountNum ;
    return custBankAccount.AccountID;
 */
   return CustTable::find(this.AccountNum).BankAccount;
}


2)
display Name displayname() // to display name
{
    DirPartyTable dirPartyTable;
    CustTrans       custtrans;
    Name               name;
    ;

    name = CustTable::find(this.AccountNum).name();

    //info(name);
    /*select Name from dirPartyTable
        where dirPartyTable.RecId==this.Party;
    return dirPartyTable.Name;
    */
    return CustTable::find(this.AccountNum).name();
}

3)
public edit Name editname(
    boolean _set,
    CustTable _CustTable,
    Name _name
    )                                               // To display name and also we can the Edit name 
{
    DirPartyTable dirpartytable;

    if (_set)
    {
        ttsBegin;
        dirpartytable = DirPartyTable::findRec(CustTable::find(this.AccountNum).Party,true);
        dirpartytable.Name = _name;
        dirpartytable.update();
        ttsCommit;

    }
    return  _CustTable.name();
}




N ow Create a new Form like below:

 

























Add the fields like above in grid set datasource as custtable and  fill the datamethod property of all fields respectively








Wednesday, February 10, 2016

Scenario:
Add a Button(GetItems) to SO and PO when we click that button(GetItems) it has to show all the item details of that selected SO and PO orders

Solution:

First create Getitems Form

Add salesline and PurchLine to the datasources

Then create a two grids POItems and SOItems and set autodeclaration as yes in properties of that grids


Drag and drop Itemid from Salesline and purchline to both the grids

Then write init method as follows


public void init()
{

    super();

    if (element.Args().caller().name()==formStr(PurchTableListPage))

    {
        POItems.visible(true);
        SOItems.visible(false);
    }

    else
        if(element.Args().caller().name()==formStr(SalesTableListPage))
    {
        SOItems.visible(true);
        POItems.visible(false);

    }


}

Create MenuItem for Above GetItems

Now goto SalestableListpage, create button and add menuitem(GetItems)to that button



 

Export a copy of the standard user acceptance testing (UAT) database

 Reference link: Export a copy of the standard user acceptance testing (UAT) database - Finance & Operations | Dynamics 365 | Microsoft ...