In my previous post I wrote about  how to use  disposable context , which is very useful in cases where we want pass an extra parameter to the method. In this post we will see how  it can be utilized to pass the value selected on dialog to table method.

I modified standard dialog which creates checks using extension and added new field bankTranstype on

it . You can get value of the added field by adding  getFromDialog method in the same extension class using coc.

Final class MybankChequeCreate_extension
	public Object dialog()
        DialogRunbase dialog;

        Dialog = next Dialog();

        this.dialogBankTransType = dialog.addFieldValue(extendedTypeStr(BankTransactionType), bankTransType, "Trans Type");

        return Dialog;

I want to pass this value to createCheque method of BankChequeTable so that I can insert/Update value selected on the dialog in this table. To do that I created another class MyBankChequeCreateContext and used it to pass  value to table method. To see how to create this class , see my previous article. createDocument method of class BankChequeCreate  calls createCheque method of bankchequetable , so in the same extension class using coc  and context class  I passed the value from dialog to table method.

public void createDocument(BankNegInstNum _chequeNum,
                               CompanyBankAccountId _accountID)
        MyBankChequeCreateContext  MyBankChequeCreateContext = new MyBankChequeCreateContext();
        MyBankChequeCreateContext._bankTransType = this.bankTransType;

        next createDocument(_chequeNum, _accountID);


Here is implementation of the  BankChequeTable  createCheque method to receive variable from the dialog.

final class MyBankChequeTable_extension
    public static BankChequeTable createCheque(BankChequeNum         _chequeNum,
                                                      CompanyBankAccountId  _accountID)
        BankChequeTable                 bankChequeTable;
        MyBankChequeCreateContext       myBankChequeCreateContext;

        bankChequeTable = next createCheque(_chequeNum,_accountID);

        myBankChequeCreateContext = MyBankChequeCreateContext::current();

        bankChequeTable.BankTransType   = myBankChequeCreateContext._bankTransType;

        return bankChequeTable;


After creating checks from the dialog , you can see check records are created with selected bank transaction type.