How to make a Pick applet and its field Read only
Requirement: The requirement is to set the pick applet and the corresponding field invoking the pick applet as Read only i.e. User can neither write to the Site field n or pick a record from the pick applet attached to Site Field to change the existing field Value. Moreover the above requirement is restrcited to a particular view.
First solution could be the use of Browser script, therefore I wrote the below code.
Go to your applet and edit Browser Script
function Applet_Load ()
if (TheApplication().ActiveViewName() == “<your view name>”) //Vanilla method to look for your view name
var FinApt = TheApplication().FindApplet(“<your applet name>”); //Vanilla method to find applet name
var FinCtl = FinApt.FindControl(“<Your control name>”); //Vanilla methd to look for a control
Compiled and generated the Browser scripts.
This solution failed to yield effective results. The ‘Site’ field was editable and I could pick any record from the pick applet as well.
Searched the bookshelf (see the link below) and I see that this “SetProperty” method only works with specific control types such as ‘TextBox’, ‘TextArea’, ‘CheckBox’ and ‘ComboBox’.
The next productive solution was the use of basic configuration and scripting.
Follow the below steps to achieve this requirement:
1.Go to your BC and create a calculated field as below:
This calculated value will refer to a profile attribute which will be set using a script as in step 3.
3. Go to Application – Pre_Navigate event and write the below code to set the profile attribute “SiteRO”
function Application_PreNavigate (DestViewName, DestBusObjName)
TheApplication().SetProfileAttr(“SiteRO”,”N”); //As a best practise set the profile attribute as N
if (DestViewName == “<your view name>”) //Query with the particlaur view name
TheApplication().SetProfileAttr(“SiteRO”,”Y”); //Set the profile attribute for a particular view