Notifications
Announcements
No record found.
public void initFromArgs(Args _args) { if(_args.record()) { if(_args.record().TableId == tableNum(SalesQuotationLine)) { quotationLine = _args.record(); } else if(_args.record().TableId == tableNum(salesLine)) { salesLine = _args.record(); } else { throw error(Error::wrongUseOfFunction(funcName())); } } } public void run() { if(quotationLine) { XContract xContract = this.initXContract(quotationLine); if(quotationLine.Field1) { Class1::send(quotationLine, xContract); } else { class2::send(quotationLine,xContract); } } else if(salesLine) { XContract xContract = this.initXContract(null, salesLine); if(salesLine.Field1) { Class1::send(salesLine, xContract); } else { Class2::send(salesLine, xContract); } } } public XContract initXContract(SalesQuotationLine _salesQuotationLine, SalesLine _salesLine = null) { XContract xContract = new XContract(); if(_salesQuotationLine && !_salesLine) { xContract.parmField1(_salesQuotationLine.Field1); xContract.parmField2(_salesQuotationLine.Field2); xContract.parmField3(_salesQuotationLine.Field3); } else if (_salesLine && !_salesQuotationLine) { xContract.parmField1(_salesLine.Field1); xContract.parmField2(_salesLine.Field2); xContract.parmField3(_salesLine.Field3); } return xContract; }
​ Common line = _salesQuotationLine ? _salesQuotationLine : _salesLine; //this errors xContract.parmField1(fieldId2Name(line.TableId, fieldNum(line.TableId, Field1))); //this also errors ​
public XContract initXContract(Common _line) { XContract contract = new XContract(); contract.parmField1(_line.(fieldName2Id(_line.TableId, 'Field1')); return contract; }
public abstract class MyProcess { public void run() { if (this.shouldDoA()) { this.sendA(); } else { this.sendB(); } } private void sendA() { ClassA::send(this.line(), this.initContract()); } private void sendB() { ClassB::send(this.line(), this.initContract()); } protected abstract boolean shouldDoA(); { } protected abstract XContract initContract(); { } protected abstract Common line() { } } public MyProcessSalesLine extends MyProcess { SalesLine salesLine; public static MyProcessSalesLine newFromRecord(SalesLine _salesLine) { MyProcessSalesLine myProcess = new MyProcessSalesLine(); myProcess.salesLine = _salesLine; return myProcess; } protected Common line() { return salesLine; } protected boolean shouldDoA(); { return salesLine.Field1; } protected XContract initContract(); { return XContract::newFromSalesLine(salesLine); } }
Common line = _salesQuotationLine ? _salesQuotationLine : _salesLine; //this errors xContract.parmField1(fieldId2Name(line.TableId, fieldNum(line.TableId, Field1))); //this also errors
SalesLine line; fieldName2Id(line.TableId, fieldStr(SalesQuotationLine, ItemId));
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 451 Most Valuable Professional
André Arnaud de Cal... 428 Super User 2025 Season 2
BillurSamdancioglu 239 Most Valuable Professional