1 of 1 people found this helpful
Yes, you can do this, but it is often a poor choice.
You can restrict access to the record by setting "limited..." edit privieges under the security settings. You would set that user's Edit privileges to
"Allow edit when:" IsEmpty (Table::First_Name) and IsEmpty(Table_Last_Name) or whatever combo is most appropriate.
This will update when the record is comitted and does not require a restart.
The problem I've consistently run into when I do this, however, is that is restricts the user from correcting their own typographic errors.
If a user mis-types the last name, then commits the record, they cannot correct their mistake.
Can you do it? Yes...but consider if it will be helpful, or if another approach such as a timestamp field may be more useful.
Setting a modification timestamp on the record, then setting the edit priveleges to allow edit for the next ten minutes or so may be more user friendly.
Allow Edit when Minute( (Get(CurrentHostTimestamp) - Get(ModificationTimestamp ) ) < 11
Try it both ways and see which is preferable...
Thanks for the tip. However, ModificationTimestamp function is not a valid. I am using version 11.3.
1 of 1 people found this helpful
True, but you can define a field that auto-enters the modification timestamp and you can modify Ninja's expression to use it in place of a Get function that doesn't exist.
Thanks very much for the help and advices.
For a level of security that allows mistakes to be corrected, but accidental changing of the names is prevented, have a look at this file.
It might meet your requirements,
Lord Of The Files
Think Data Pty Ltd
+61 7 5442 5624
+61 413 350 993
lockfields_2.fp7.zip 14.5 K
I meant to give the general idea, not the specific code and I was unclear in doing so...(like I didn't say that's what I was doing )
The Get (Modification Timestamp) I typed is not a function, it was just how my brain saw the following:
Create a "modificationTS" field...
Set it to update to Get(CurrentHostTimestamp) whenever the record is modified
Plug that "modificationTS" field into the Privileges expression... not the literal Get(modificationTimestamp) I typed...you are correct, it is not a real function.
Again, sorry for taking the mental shortcut and not being very clear.
Just a small point - your use of Get(CurrentHostTimestamp) in this particular situation might not be the most reliable, since you are comparing that timestamp with the Modification Timestamp, which comes from the Client machine. If the clocks in the server and the client start to differ, your record lock may become erratic. If the comparison uses the time from the clock in the client machine then there is less chance of error.
There is also the issue of handling the switch to Daylight Saving time, particularly for late night users ...
Best wishes - Alan Stirling, London UK
A valid point. Using the Host Timestamp does, however, bypass the ability of the user to control the timestamp by changing the time on the client machine. Unless I misunderstand something, a user can foil the local timestamp by changing the clock on the client machine and generate a "false" timestamp. Using the Host Timestamp, the Timestamp cannot be altered from the client machine.
Again, it is a valid point regarding Daylight Savings time...have to noodle on that one for a while. Any suggestions are welcome.
I think Bobster's solution is effectively very clever.
However, i think we can now also use the triggers for that :
It is a bit more work on the layouts but leave a cleaner structure. All concerned field objects must have an OnObjectModify trigger that fire a simple script like :
#Script to be triggered when OnObjectModify for ALL desired fields
If [ Get ( RecordOpenState ) = 2 ]
#Or whatever other test like : Globals::Lock or Privilege Name etc....
Undo/Redo [ Toggle ]
Show Custom Dialog [ Message: "Modifications are no longer allowed"; Default Button: “OK”, Commit: “Yes” ]
What do you think about ?