Solved

Looking for a design pattern

  • 21 September 2023
  • 2 replies
  • 30 views

Userlevel 7
Badge +5

I have a screen called Transaction Entry.

When a certain criteria on a related Sales Order is not met, Transaction Entry should be read-only. And I’d like to let the user know that the condition on the Sales Order has not been met.

Currently I’m using RowSelected to test for the condition on the Sales Order. If it fails, then I’ve been setting e.Cache.AllowUpdate = false. In addition, I have been setting:

e.Cache.RaiseExceptionHandling<MyDac.transactionNbr>(e.Row, e.Row.TransactionNbr, new PXSetPropertyException(“Condition failed”))

I’ve used this elsewhere so that the user can see the red X and know why they can’t edit the record.

BUT

Since RowSelected is fired while I’m creating the record when the Sales Order condition hasn’t been met, my code is throwing the exception.

So, is there a more correct way to alert the user when they pull up a record as to why they cannot edit the record?

At this point it feels like it will be easier to create a PXAction button that I can show/hide and give it a meaningful caption for the user. But I wonder if there’s an issue with my design or that I’m missing a better way to do that within the framework.

 

icon

Best answer by darylbowman 21 September 2023, 08:56

View original

2 replies

Badge +11

Did you specifically want it to be an error? You could do the same thing but set a warning instead, which displays the yellow warning box, but doesn't prevent anything systematically.

Userlevel 7
Badge +5

No - it doesn’t need to be an error. Just something to alert the user so they aren’t left having to figure out why they can’t make any changes to the transaction.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved