I agree with Kevin. Another reason to avoid is because with S/O Entry they will keep asking for more of this when you do get it to work. The issues with changing grid cell/column/row control states are all about the timing. E.g. If you disable UnitPrice on the Panel PostLoad of PLines as a UI script, the system may then re-enable it after your script completes making you think your script didn't work. You could then try to re-disable UnitPrice when user clicks on the line but PostRead isn't a UI event (which is what you really need and not available to scripting on grids) so it may not work. If it does work, you results may not be consistent.
If you study it hard enough most likely you will figure out something that works but remember you have to support it on future versions too and there is always that good chance the customer will ask you to further enhance your logic.
It's not as temperamental to color rows and cells (if you have all your events covered) but what's even easier is to do what Kevin suggested. You could use SetStorageVar and GetStorageVar instead of UDF if you wanted.
------------------------------
Alnoor Cassim
Email:
alnoor@asifocus.comPh: 949-689-9887
Orange County, CA
------------------------------
Original Message:
Sent: 08-20-2021 09:58
From: Kevin Moyes
Subject: Script to disable fields in SO Entry Lines grid
Grid scripts are horribly temperamental. I've done this kind of thing a different way, with a pair of scripts.
- Capture the Original Unit Price in a UDF (column post validate on quantity, only set when the UDF is blank, so only the first non-zero value is captured).
- Then column post validate on UnitPrice... with IsMember check and any other kind of filters you wish. When the value entered is less than the Original Unit Price: SetError.
------------------------------
Kevin Moyes
Technical Systems Analyst
Munjal White Consulting Co.
Toronto ON
------------------------------