Edit

WriteCurrentRecordForWindow (windowRef, fieldArray)

Result type:  none

Definition:  This function is normally used in the After handler of a custom record editing window, operating on User, User2, OffLedger or Lists. The window will have been instantiated automatically via the second parameter of CreateListWindow in response to a New or Modify command.

The function writes the current record in the selection associated with the window (or creates a new record, as appropriate). FieldArray is an associative array containing the value of every field in the record (the keys of the array are the field names). Usually, you will pass back a modified version of the array you got from ReadCurrentRecordForWindow.

Call this function from the After handler of your record editing window to save changes to the data.

Updating UserNum and UserText and tagged fields on other tables

An alternative use of this function is in a Validate (or ItemHit) handler for a standard entry window. In this case the only fields to be updated will be UserNum and UserText. You must call the function before MoneyWorks writes the record (the After handler would be too late in this case). Calling this function will mark the window as changed and force MoneyWorks to save the record in the standard After phase. (Note, however, that the Validate handler will only be called if the user changed a value in the window).

Availability:  available within MWScript handlers.

See Also:

GetWindowProperty: Retrieve data previously stored for a windowHandle

ReadCurrentRecordForWindow: Load a record in custom UI, or tagged fields in standard UI

SetWindowProperty: Store data related to a window