Line Defaults Tab in Enter Sales Order

There are certain fields on the Line Defaults tab that prompt to change all open lines i.e. Requested, Sched Ship, Promised Date fields, Ship Via, Shipping Priority.  The same doesn't go for Reference or FOB.  Has anyone tried to customize to allow another field to prompt to change all Open lines or know of a way to allow for that?

Thanks.

  • 0

    Some controls (fields) have logic associated with them that disallows an automatic change like this including the status of the order and line. For example, if the line is open then changing the FOB could cause a recalculation of the sales tax for the line. It's possible to change this in an automated fashion but you would need to know the rules for that control and fire the additional code and update the amounts or related controls necessary to maintain the consistency of the form data. The same goes for your Reference Code since the value has to be validated against the codes that have been entered in GL.

    In general for other controls though, you could add a button with an input box or code a lost focus event to update the grid data, or even run the update against the data directly (stored procedure with the correct validations for instance). A direct update might be the easiest method, but if you save the form then any updates you write to the back-end will more than likely be overwritten with the form data. There are ways around this like disabling the finish and save buttons in the toolbar or just fire the cancel and repopulate the form with the new data all using CZ.

    To manipulate the grid data using CZ though you generally need to determine which column matches the data you want to replace by looping through the columns in the column headers (typically row 0), or hard code the column number (there are also multiple grids you don't see that are used in the form). The problem with hard-coding values that the visible grid in this form is customizable so the columns may not always be in the same order, but a very simple construct to manipulate grid rows looks something like this:

    Dim lCol
    Dim lRow
    Dim sNewData

    lCol = 2
    lRow = 1

    sNewData = Form.Controls("<ControlName>")

    'Loop through grid
    For lRow = 1 to Form.Controls("grdDetail").MaxRows
        'Set cell value
        Form.Controls("grdDetail").SetText lCol, lRow, sNewData
    Next

    Again, a very simple method to scroll through a grid. You need to add data and error handling, form state, user prompts and messages, etc.

    You can perform actions against the grid data as well maybe after you set a new cell value. For example, the following will recalculate the line amounts which triggers a recalc of the order amount:

    Form.Controls("grdDetail").Action = 11

    Actions may or may not work as expected depending on how the grid is coded and the context of how you're using the action:

    Active Cell = 0
    Goto Cell = 1
    Select Block = 2
    Clear = 3
    Delete Column = 4
    Delete Row = 5
    Insert Column = 6
    Insert Row = 7
    Load Spread Sheet = 8
    Save All = 9
    Save Values = 10
    Recalculate = 11
    Clear Text = 12
    Print = 13
    Deselect Block = 14
    DSave = 15
    Set Cell Border = 16
    Add Multi Selection Block = 17
    Get Multi Selection = 18
    Copy Range = 19
    Move Range = 20
    Swap Range = 21
    Clipboard Copy = 22
    Clipboard Cut = 23
    Clipboard Paste = 24
    Sort = 25
    Combo Clear = 26
    Combo Remove = 27
    Reset = 28
    Select Mode Clear = 29
    VMode Refresh = 30
    Refresh Bound = 31
    Smartprint = 32

    If you haven't worked much with CZ or VB code in the past, I wouldn't recommend you start with Enter SO since it is probably the most complex form in the application. There is a lot of functionality and logic integrated with data manager and validation manager that you need to account for, as well as settings and security specific to the form.