Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 312
  • Last Modified:

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.
  • 2
2 Solutions
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!
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.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now