Extend SalesTable2Line Framework

Dynamics AX provides a Framework for updating changes made on SalesTable fields to SalesLine fields. The update method can be configured within Dynamics AX at Accounts Receivable > Setup > Parameters > Updates > “Update order Line”. This form is used to configure if and how changes made to the SalesTable are written to the lines. This framework can be extended to update your own fields, like a “Notes” field in the example below.

Dynamics AX 2009 Update Order Lines

  1. Create a new field called "SalesNotes” in the SalesTable and SalesLine
  2. Add the SalesTable.SalesNotes field to the Field Group HeaderToLineUpdate at the SalesTable
    Put Sales Notes field HeaderToLineUpdate group in the SalesTable
  3. Display the new fields in the SalesTable form e.g. in the General tab
  4. Open the SalesTable2LineParameters table in the table browser and remove all records. Don’t worry, these data will be populated automatically and is the basis for the “Update order line” form.
  5. Add the following line to the SalesTable2LineField.lineUpdateDescription method

    case fieldnum(SalesTable, SalesNote):
        return fieldid2pname(tableNum(SalesLine), fieldNum(SalesLine, SalesNote));

    Modify the SalesTable2LineField.lineUpdateDescription method

     

  6. Add a parameter method for the SalesNote field to the AxSalesTable class

    public SalesNote parmSalesNote(SalesNote _salesNote = ”)
    {
        if (!prmisdefault(_salesNote))
        {
            this.setField(fieldnum(SalesTable, SalesNote), _salesNote);
        }

        return salesTable.SalesNote;
    }

  7. Add a parameter method for the salesNote field to the AxSalesLine class

    public SalesNote parmSalesNote(SalesNote _salesNote = ”)
    {
        if (!prmisdefault(_salesNote))
        {
            this.setField(fieldnum(SalesLine, SalesNote), _salesNote);
        }

        return salesLine.SalesNote;
    }

  8. Create a setSalesNote method on 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());
        }
    }

  9. Modify the setTableFields method to call the setSalesNote method
    Call the setSalesNote method
    Test your modification. Open the “Update order line” form and set the update method for Sales Notes to “Prompt”. Open the sales order details form, go to your new field, modify the text and save. A dialog will appear and ask your to update the Note fields. Click OK, and review the Sales Notes in the SalesLines.

Modify the SalesNote value in a sales order

Review the update on the sales line

HP MT 3300 in SBS 2008 Environment running Dynamics AX 2009

image

I’ve recently added a HP MT 3300 Desktop PC to a Small Business Server 2008 domain running Dynamics AX 2009. Out of the box I was facing two issues:

1) SBS 2008 reported an error it could not communicate with the new client machine.

2) Opening the AOT was freezing the Dynamics AX client and crashed after a while because of insufficient memory. Very strange issue that could not to be fixed with any rollup or hotfix for Dynamics AX 2009.

 

 

Solution 1)
Per default the machine is running Norton Internet Security. Go to Settings > Network Settings > Firewall > Access Control. Set the SBS Server machine to Full Trust.

image

Solution 2)
Thanks to Microsoft Support: HP Security Manager is causing this issue (not only on MT 3300). Go to C:\Program Files (x86)\Hewlett-Packard\HP ProtectTools Security Manager\Bin and find the DpFbView.dll file. Rename the file to DpFbView.old.

Visualize DocuRef notes in grid

With Dynamics AX you can attach document references like Word files, Excel sheets, mail, fax and notes to any displayed record. The icon to do so can be found in the forms toolbar. Unfortunately it’s hard to discover if a document is attached to a record. Therefore it’s helpful to display an icon in the overview grid to indicate attached documents.

document references

Create a new Integer extended data type called DocuRefIcon and label it with Documents (@SYS124737). Set the help text to Document Handling (@SYS22623).

Add a display method showDocuRefIcon() to the CustTable. Document references use a RefTableId and RefRecId to reference any record in Dynamics. If there is a document reference for the current CustTable record return resource id 3028 otherwise return id 0.

//BP deviation documented
display DocuRefIcon showDocuRefIcon()
{;
    if(DocuRef::exist(this.dataAreaId,this.TableId,this.RecId))
        return 3028;
 
    return 0;
}

Open the CustTable form and a new icon to the Overview grid. Set width and height properties to 16. Set CustTable as datasource and showDocuRefIcon as data method. Save and open the form. Attach a document reference to a customer and you’ll see a notes icon in the new grid column.

document handling icon in custtable grid