Edit

DoForm (formName, format, search [, parameters, ...])

Result Type:  a path string

Definition:  Generates a pdf file containing custom form output.

Format will usually be "pdf". The return value in this case is the path to a temporary file that will be deleted when you quit.

From MoneyWorks 8.0, the format may also be "preview", in which case the output will be displayed in the review window.

Parameters (for the form) should be strings in the form "paramName=paramValue". An associative array is also acceptable. If the form makes use of an ephemeral system variable such as MESSAGE (which is set only when the Print Invoice command is used), you must set a value for those variables in the parameters (because if no invoice has yet been printed in the session, MESSAGE will not yet exist).

Example: 

let path = DoForm("Product Invoice 1", "pdf", "sequencenumber=992", "message=", "print_copy=0")

If multiple records are selected, all output still goes to the same PDF.

Availability:  MWScript handlers. Thus function is closely analogous to the command line and REST doform commands.