David, that helped! I had the field name slightly wrong. Thank you for pointing me down that path.
One follow up question. Now it works, however its like its not resetting itself properly.
So, the logic is if the employee is a new record, the field should be available to everyone. If the employee is existing, only certain roles can change the field.
As the restricted user:
If I open Employee Maintenance & create a new employee, the field is available (which I want)
If I open Employee Maintenance & open an existing employee, the field is disabled (which I want)
If I already have Employee Maintenance open & previously created a new employee, then go to an existing, the field is disabled (which I want)
If I already have Employee Maintenance open & previously selected an existing employee, then try to add a new employee, the field is still disabled (it should not be). I have to close & re-open Employee Maintenance & it is then enabled again.
Its like its not resetting itself when I have previously disabled the field on a prior record. I am watching the script in debugging & its setting my "new" logic correctly. Once it sees it as a new employee, it should "exit sub"
I am using Event - Post Read; I can't think of any other that would work here.
Any thoughts? Thx!
------------------------------
Dana Young
Lehman Wesley & Associates
Lansing MI
------------------------------
Original Message:
Sent: 03-24-2020 00:46
From: David Speck II
Subject: SetUIControl question
Depending on when your script might be running, there could be subsequent sage logic running which might be reverting whatever you set. Try using the other UI control state, i.e. if you are trying to disable it and it doesn't appear to be working then try hiding it.
Also, use Customizer to be absolutely sure of the control's name. There are some controls for fields that have a prefix like "ML_" so if you are strictly going off the field name in the table, you may not ever get the actual control name.
------------------------------
David Speck II
Tennessee Software Solutions
------------------------------