Thursday, Oct. 19, 2017

How to make a Pick applet and its field Read only

Written By:

|

February 18, 2013

|

Posted In:

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
FinCtl.SetProperty(“ReadOnly”, “TRUE”);
}
}
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’.

Bookshelf Link

 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:

 Pick applet readOnly2

This calculated value will refer to a profile attribute which will be set using a script as in step 3.

2.Go to your BC . Expand BC Object to see BC user Property and create a new record to use Field Read Only Field user property which refers to the calculated field ‘Site_read_only’ as shown below.Pick applet readOnly1

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
}
            return (ContinueOperation);
}

Tricky Learning!!!



Share This Article

About Author

Gurdeep

Hi, I am sharing my experience to alleviate beginners with open UI and HI version of Siebel CRM. I work in Sun Life Financials and can be reached via IT Tool box as well. Thanks.

Comments are closed.

Leave A Reply