Siebel CRM Desktop for IBM Notes Administration Guide > Customizing Siebel CRM Desktop > Process of Adding Custom Objects >
Adding Custom Logic
This task is a step in Process of Adding Custom Objects. To improve usability, sometimes you must add custom logic to Siebel CRM Desktop that allows the user to manipulate IBM Notes data. For example:
- Automatically include the current user Id in the Owner field.
- Cause the first letter of each word in the description of an activity to automatically capitalize.
CRM Desktop uses LotusScript classes to customize IBM Notes data. It runs this LotusScript on events, so you define the events that are involved and you specify the code that this script calls when an event occurs. To do this, you may modify correspondent event handlers in the form's objects tab: QueryOpen, PostOpen, QueryModeChange,PostModeChange, QuerySave, PostSave, and QueryClose. You create a new class and name it. For example, FormActivityEx.CRM Desktop inherits the FormActivityEx class from the SBL.Forms generic script library. You then add the following methods to the FormActivityEx class: Public Sub PostOpen(uiDocument As NotesUIDocument, id As String) Public Function QuerySave As Boolean
To add custom logic
- Open IBM Domino Designer, and then open the form you must modify.
For example, open a form that you created in Defining the User Interface.
For more information, see Opening IBM Domino Designer.
- Specify the Globals:
- Click the Objects tab, and then navigate to Globals.
- Locate the Initialize section.
- Add the following code to the Sub code section that resides in the section that you located in Step b:
Set m_FormHandler = New FormActivityEx
This code creates a form handler. It connects the form with the corresponding class. For more information, see Example of the FormActivityEx Class.
- In the Options, add the following code:
Use SBL.Forms
This code connects the common SBL.Forms script library with the new class and the new form.
- In the Declarations section, add the following code:
Dim m_FormHandler As FormActivityEx
This code declares a variable that uses the type that m_FormHandler uses.
- Specify the events:
- In the Objects tab, switch the events for the form.
- Choose the PostOpen event and then add the following code to the Sub code section:
m_FormHandler.PostOpen Source, ""
- Choose the QuerySave event and then add the following code to the Sub code section:
Continue = m_FormHandler.QuerySave
- Choose the QueryOpen event and then add the following code to the Sub code section:
Continue = m_FormHandler.QueryOpen(Source)
Example of the FormActivityEx Class
The following code is an example of the FormActivityEx class: Public Class FormActivityEx As SBLFormEx Public Sub PostOpen(uiDocument As NotesUIDocument, id As String) 'This code prefills the Owner field with the Current User Id value SBLFormEx..PostOpen Uidocument, Id If Me.DocumentEx.SafeProperty("CRMEmployeeId", "") = "" Then Me.DocumentEx.Property("CRMEmployeeId") = GetSession().CurrentUserID End If End Sub Public Function QuerySave As Boolean 'This code makes the first letter in the Description field Capital Dim Description As String Description = Me.DocumentEx.SafeProperty("Description", "") If Description <> "" Then Me.DocumentEx.Property("Description") = UCase(Left(Description, 1)) & Mid(Description, 2) End If End Function End Class
|