I have a receipt that will be created. User needs to be able to choose item and quantity, etc.
But after the receipt is printed, I need the fields then to "lock out" or not be able to be entered or edited after printing.
Do it all the time.
We use a script that prints the invoice and that script changes a status field to "printed".
In Manage | Security, our general users have "custom privileges..." specified for Records for their privilege set.
Inside the dialog that option opens, I selected the Invoice table and in the "Edit" drop down, selected "limited".
In there I put in
Status <> "Printed"
And this keeps the users from editing an Invoice Record if it's status is "printed".
I then set up similar options for the line items table, but also blocked the ability to create line items.
I may have missed a step.
I've created a new Privilege Set for the users needing to be locked out of changing a receipt. (maybe everyone should be.???)
Value list for Receipt status = Pending, Void, or Printed
So in the Privilege Set I have set for the table TRANSACTIONS:
View = yes
Edit = limited (where Receipt Status does not equal "Printed"
Create = yes
Delete = no
Field Access = all
Then for the table LINE ITEMS:
Edit = limited (same as above)
Problem seems to be that my working receipt layout is still modifiable by the user even if status is "Printed." They can add another Line Item. But once it moves to the receipt layout to be printed, nothing can be added.
They can add another Line Item.
Which would be an action that creates a record does it not? And you have made no restrictions on that.
But it will still be an issue as the lock expression references a status in a related table. It won't lock the user out until the record is committed as it won't access the status field in the parent record until then. So adding a record in line items and editing it prior to committing will still be possible.
It's been years and many versions since I last had to do this, but as I recall, you can set up a field validation calculation that rejects the new record if the parent is "printed". This would work across multiple layouts.
Another trick might be to add a portal filter expression that omits the blank "add row" if the invoice is Printed.
Say your match field linking a portal record to the parent is named _fkInvoiceID. then a filter expression such as:
Not IsEmpty ( LineItems::_fkINvoiceID ) or Invoice::Status <> "Printed"
Retrieving data ...