Interested in creating and selling training? You pick the price, 50/50 revenue share, and you own the content. Find out more at
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.parmQuery(query); sysTableLookup.parmTmpBuffer(DRRepParameters); //set our populated buffer! sysTableLookup.performFormLookup(); }
public static void main(Args _args) { WIZDRRepDialog repCreate = new WIZDRRepDialog(); // Prompt the dialog, if user clicks in OK it returns true if (repCreate.prompt()) { repCreate.run(); } }
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; ttsBegin; requestTable.insert(); //salesTable.update(); ttsCommit; Box::info("Sucessfully sent!", "Request DR Reprinting"); } else { Box::warning(notes, strTitle, ''); } } else { Box::warning(strFmt('Invoice Id %1 is still pending for approval', custInvoiceJour.InvoiceId),strTitle,''); } } else { error('Reprint Id is not found!'); } } else throw error("Incorrect table record for processing"); super(); }
If you have better ideas or suggest, please let me know.
Thank you in advance.