There are several ways to make a field read-only.
In fact I had written about the glorious ways to make a field read-only in Siebel .
While you can apply any method you like as long as they work (and, they do work), developers often forget the fact that “a back door is needed in more ways than one”.
- Users can mistakenly update a field and make the entire field read-only
- You may start getting support requests to change one or more fields on read-only records since the “TPS reports” are now showing correct data (click here for a laugh if you don’t know what is TPS )
- Some developer was testing something in production, and the world came crashing down since he pressed Ctrl+S (sorry, no references or jokes. You should know Ctrl+S, else you are wasting time here)
Typically you try to avoid read-only fields, but play around with a few alternative methods.
1. Use read-only at the UI level
Just flag the read-only flag against the Applet control or List Column. You could make the entire applet read only if you are in a mood to do something dangerous. Well, there is no “read only” flag at the applet level - unfortunately. You would have to check the “No Update” flag.
2. Use conditional read-only user property in Business Components or Fields
At the BC level, use the following user property.
Name: Field Read Only Field: [Target Field] Value: [Field name that drives read-only behaviour]
Worst case you can make the field read-only for every condition by just providing an expression that evaluates to TRUE (e.g. “1=1”, or a simple TRUE!).
You can then provide the back door for sneaky updates using Admin Mode view. Conditional read-only properties do not work in views that are enabled in “Admin Mode”.
This is one of the popular ways of enabling updates on read only fields for administrators. You can typically find them in the Data Administration views.
3. Use Aspect user properties
Set Aspect at the applet level, and use Aspect user property to manipulate read-only behaviour at the BC level.
Name: Aspect BC Read Only Value: [Aspect value]
What if mistakes are committed in the past?
If you have already made the field read-only, and desperately struggling to find your way out, help is here -
Use Alternate Business Components
Find a different BC on the same table. Get hold of the relevant field, and start updating it via any available UI. If no UI is available, create a client business service, or a simple workflow to read from file and update the given field.
Use Client Business Service
The client business service is useful when you have a conditional read-only field.
You could simply say -
SetAdminMode in script has saved me in the past.
Enterprise Integration Manager enables batch integration. You could write a quick script to update a field and easily bypass the business layer read-0nly specification.
Finally, all these are just work around solutions. You would of course queue this as a change request for a future release.