WF On User Input of Field calling a function

WF On User Input of Field calling a function

As the Title implies, I have an Invoice form with a Lookup field called Car. When the user enters a value, I want to create a series of SubForm (charge) rows with data entries that depend on the Car form. I have a Function that describes how many lines to create and default values for most SubForm fields. My Form Workflow code is below. It triggers an error within the Charge function because no Invoice gets passed to the Function.

//
Inv = Invoice[ID == input.ID];
thisapp.Invoice.Charge(Inv);
//