how can i stop people from adding lines to the invoice when they are allowed to create invoices & inv lines

I was able to create a privilage to stop anyone from editing an invoice or an invoice line once a field on the invoice is changed to done. but they can still add invoice lines because they are creating a record and I need to allow them that privialge. how can i stop people from adding records to an invoice once it's marked done.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

disable "new record" from menu (minimum menus in privileges or custom menus), and new records creation though the relationship if you use a portal.
and make a script to create a new line in the related table which will check the invoice 'done' field before generating the new related record.
to get the invoice ID written to the line ID, you can use a subscript with an argument to carry the invoice ID or use a variable like:

if (invoice::done<>"done")
 set variable ($ID=invoice:ID)
 goto layout (lines layout)
 new record
 set field lines:invoiceID = $ID
 goto layout (original)
 custom dialog (invoice is closed!)

this is not the real syntax, just the principle, you had guessed it!
I suppose that you look at your invoice lines through a portal on the invoice layout.

You can simply change the settings of the relationship with the invoice lines table, to disable "allow creation of new records" and from then on it is not possible to add new rows to the portal that shows the invoice lines.

Now add a button to your layout that says "create new invoice line". The button triggers a script that checks if the invoice is completed, after which it exits. If not, then it goes ahead and creates a new related record in the invoice_lines table (or file).

This is actually the strategy lesouef proposes, I just decided to comment to clarify things a little. Hope you don't mind, lesouef!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
please do! I absolutely don't care!
RALPHQCAuthor Commented:
I was looking for a script to create a new portal record if ; (like delete portal record script step) so i didn't understand the original ans.
I was able to workit in the solutions.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
FileMaker Pro

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.