Skip to main content
Answer

Looking for a design pattern

  • September 21, 2023
  • 2 replies
  • 46 views

Forum|alt.badge.img+7

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.

 

Best answer by darylbowman

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.

2 replies

darylbowman
Captain II
Forum|alt.badge.img+15
  • Answer
  • September 21, 2023

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.


Forum|alt.badge.img+7
  • Author
  • Captain II
  • September 21, 2023

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.