How to pass record args from Main method to Run method using Extend RunBase ax 2012?

Hi all,

I have problem in passing record args from main method to Run method.

I will share my code here so you can understand what i am trying to achieve.

class WIZDRRepDialog extends RunBase

    DialogFIeld repIdField, repReasonField;
    DRRepParameters   dRRepParameters;

    DRRepNumSeq dRRepNumSeq;

protected Object dialog()
   DialogRunBase   dialog;
    FormStringControl ctrl1;

    dialog = super();
    repIdField    = dialog.addField(ExtendedTypeStr(DRRepNumSeq), "Select Reason: ");   
    ctrl1 = repIdField.control();
    ctrl1.registerOverrideMethod(methodStr(FormStringControl, lookup), methodStr(WIZDRRepDialog, lookupTest), this);

    return dialog;


public boolean getFromDialog()
    // Retrieve values from Dialog
    dRRepNumSeq = repIdField.value();

    return super();

protected void lookupTest (FormStringControl _control)
    Query                   query = new Query();
    QueryBuildDataSource    queryBuildDataSource;
    SysTableLookup          sysTableLookup = SysTableLookup::newParameters(tableNum(DRRepParameters), _control);

    sysTableLookup.addLookupField(fieldNum(DRRepParameters, Key));
    sysTableLookup.addLookupField(fieldNum(DRRepParameters, Reasons));

    queryBuildDataSource = query.addDataSource(tableNum(DRRepParameters));

    sysTableLookup.parmTmpBuffer(DRRepParameters);  //set our populated buffer!

public static void main(Args _args)
    WIZDRRepDialog repCreate = new WIZDRRepDialog();
    // Prompt the dialog, if user clicks in OK it returns true
    if (repCreate.prompt())

public void run()
    Args _args = new Args();
    str strMessage = "PAULIT-ULIT!? KAYA KA NASASAKTAN EH! \nYour Trial is Excedeed! \nPlease coordinate with CNC Department.";
    str strTitle = "DR Request Reprint Form";
    Notes   notes;
    WIZDRRepDialog controller = new WIZDRRepDialog();
    CustInvoiceJour custInvoiceJour;
    wizRequestTable requestTable;

    dRRepParameters = DRRepParameters::find(dRRepNumSeq);
    if (dRRepParameters)
            if(_args.dataset() == tableNum(CustInvoiceJour))
                custInvoiceJour = _args.record();
                if (wizRequestTable::find(custInvoiceJour.RecId, custInvoiceJour.dataAreaId).ApprovalStatus != DRApproval_Status::ForApproval
                || wizRequestTable::find(custInvoiceJour.RecId, custInvoiceJour.dataAreaId).ApprovalStatus == DRApproval_Status::None)
                        if (custInvoiceJour.CountPrint != 2)
                            requestTable.Reason = dRRepParameters.Reasons;
                            requestTable.RepId = dRRepParameters.Key;
                            requestTable.InvoiceId = custInvoiceJour.InvoiceId;
                            requestTable.SalesId = custInvoiceJour.SalesId;
                            requestTable.CustInvoiceJourId = custInvoiceJour.RecId;
                            requestTable.ApprovalStatus = DRApproval_Status::ForApproval;

                            Box::info("Sucessfully sent!", "Request DR Reprinting");
                                Box::warning(notes, strTitle, '');
                        Box::warning(strFmt('Invoice Id %1 is still pending for approval', custInvoiceJour.InvoiceId),strTitle,'');
                    error('Reprint Id is not found!');
            throw error("Incorrect table record for processing");

If you have better ideas or suggest, please let me know.

Thank you in advance.

  • I don't see any code for serialization, therefore no variables will be passed from client (= dialog) to server, where the logic is executed. This is clearly a bug.

    I recommend you forget this old framework and use the SysOperation framework instead; it will serialize and deserialize data contract classes for your. If you insist on using the legacy framework, study how to implement pack() and unpack() methods.

Reply Children