Don't think a script using set field is necessary here, but it's hard to tell from your description.
Here's a demo file created by Comment in a different FileMaker forum. Note how you can select from a drop down to create new line item records.
Does this do what you want here? If not please describe what you need in more detail.
Okay I'll give it another go...
The example that you referred to is pretty much how my solution is set up. There is a product table where they can pick products from and they pull in the price and tax and everything is added up in line items and displayed nicely in the portal. That part I have down pat.
What they are wanting is to send automated warnings after the client hasn't paid on time. the first time would just be a warning so there's no problem there. Could be done with scripting or conditional scripting on some text. The problem comes with the second and third warnings when they actually are going to start charging admin costs. Which means a line item needs to be added to the invoice. Till now I've had these warnings permanently placed in the products table, but sometimes people erase them or change them accidentally. Just not a well rounded solution. I was thinking maybe it would be possible to somehow add these warnings to the products pop up menu, but have them fill the info in in their prefs (global fields).... or I was thinking is it possible to have a script that temporarily looks info up from another table ( which would then become the warning or admin cost prefs. They could then press a button like they do when they add products and then field would temporarily refer to a different table.... writing this down ..... I'm thinking another kf_id refering to another table and haveing the button go there... could work, but would is mess things up in the lines having info coming from somewhere else and not the main kf_id it's linked too? Maybe I'm making this problem way more difficult than it needs to be (-:
Hope this clears things up....
Making late charges a product so that they are just another line item is an option--especially if the late charge is a flat fee. Since most such charges are a percentage of the invoice total, however, you might consider putting such charges in either dedicated invoice fields that are included in the the invoice total calculation or you might have a separate related table (since more than one late fee can be assessed) where these are recorded. Either way, since the fields are separate from the portal, direct access to the field or fields can be prohibited by using the behavior section of the Inspector to deny field access while in Browse mode.
And a script to add the relevant late charge could indeed be written and assigned to a button where it would use set field to add a new late charge to the invoice.
Yeah I was leaning more towards that idea as I was writing the clarification (-: Thanks again!