How do I prevent data entry in a field in Browse mode (I know how to do that) and at the same time allow me to enter data when I add a new record thru script?
The reason why I need this feature is, because the users are going to the field and accidently changing data and it causes lots of issues, because this date field is formatted to accommodate unique value.
Any trick appreciate...
Several ways you could attack this.
You can control whether a end user can access a field in Browse or Find mode by using the Inspector (Data tab > Behavior section.) While in Layout mode with the field highlighted - simply uncheck the modes you don't want the end users getting into.
Even if you do this, a script can still enter a value into that field - for example, using the Set Field script step.
A way to do this to allow entry only if blank (ie. not change existing value) is to make the filed itself a button that launches a script:
If (IsEmpty(the field) )
GoToField (the Field)
If there's a value in the field, trying to get into it will commit the record instead.
WARNING: If you put the wrong value in that field...you won't be able to go in to correct it...
also consider removing the field from the tab order as well...or set up the script for OnObjectEnter
You actually asked about hiding it...
You can set up (In Inspector Data Tab) Hide object if: not IsEmpty( the Field)
basically, this can't be done inside the same layout. One way to accomplish your goal is to use two Layouts:
- first Layout to browse data, that field does not allow data entry
- second Layout to add a new record, that field allows data entry
If you prefer to use only one Layout, you may put two versions of the field one on top of the other and have a single one visible at anytime, depending on wether you look at an existing record or create a new record.
I wish I knew that a while ago. It can be used to protect relationship links.
I am sorry I didn't phrase it correctly.. Shouldn't hide the field, rather not modifiable during Browse mode and should allow me to go to the field and select a date from the drop down calendar. But this entry will trigger by a script and the script will take me the date field and SHOULD allow me to select a date from the pop-up calendar.
I am familiar with the field Behavior feature of hide/unhide etc.
Thanks any way
I thot about it before I started this discussion...My issue is that, I do have plenty of scripts that address this particular layout...Looks like I have to adopt this method as my solution, have to edit all my scripts..
Thank you so much for your time..
To answer it very precise:
How do I prevent data entry in a field in Browse mode (I know how to do that) and at the same timeallow me to enter data when I add a new record thru script?
Do as you probably already do: Set the field to be inaccessible (visible but not editable) in browse mode.
Then when you add a new record through you script you can set the value (set field). You can even use a dialog to ask the user to enter data into the field in the dialog and then set the field to this value.
An alternative solution, if you want the entire record to be editable just after creation but do not want anyone to edit this field after that: Have a script trigger on the field sending the user out when entering, if the condition is met.
You should probably consider adding conditional formatting to the field when it is not open for editing to make the user understand this visible also.