The SalesTable2Line framwork is used in AX to update fields on the SalesLine when the corresponding field in the SalesTable was changed e.g. DevliveryMode. Follow these steps to extend the framework for your own fields.
Create a new field in the SalesTable and SalesLine e.g. a SalesNote field
Add the field to the FieldGroup HeaderToLineUpdate in the SalesTable
Display the new fields in the SalesTable form
Delete all records from the SalesTable2LineParameters table
Open Accounts Receivable > Settings > Parameter > “Update order line”
Extend the SalesTable2LineField.lineUpdateDescription method
case fieldnum(SalesTable, SalesNote): return fieldid2pname(tableNum(SalesLine), fieldNum(SalesLine,SalesNote));
Add parm methods for the new field to AxSalesTable and AxSalesLine classes
public SalesNote parmSalesNote(SalesNote _salesNote = “) { if (!prmisdefault(_salesNote)) { this.setField(fieldnum(SalesLine, SalesNote), _salesNote); } return salesLine.SalesNote; }
Create a set method in the AxSalesLine class
protected void setSalesNote() { if (this.isMethodExecuted(funcname(), fieldnum(SalesLine, SalesNote))) { return; } this.setAxSalesTableFields(); if (this.isAxSalesTableFieldsSet() || this.axSalesTable().isFieldModified(fieldnum(SalesTable, SalesNote))) { this.parmSalesNote(this.axSalesTable().parmSalesNote()); } }
Add the call of this set method in the AxSalesLine.setTableFields method