Siebel CRM Desktop for IBM Notes Administration Guide > Customizing Picklists > Process of Creating Hierarchical Picklists >
Linking Fields and Testing Your Hierarchical Picklist
This task is a step in Process of Creating Hierarchical Picklists. If the user chooses a value in the parent picklist, then this value filters the values that CRM Desktop displays in the child picklist. To set up this relationship in:
- Siebel Tools. You set up a constraint on the pickmap.
- Siebel CRM Desktop. You write a Lotus Script code in the Opportunity form handler and Opportunity form.
This code implements the business logic for the Opportunity form. The SBL.Forms library includes similar code for each form that Siebel CRM Desktop displays. If you do not establish this relationship between the parent picklist and the child picklist, then the parent dropdown list displays all parent values as options and the child dropdown list displays all child values. To link fields and test your hierarchical picklist
- Open the SBL.Forms script library in IBM Domino Designer.
- Add a new class:
'/** ' * Callback class for clearing fields ' */ Public Class CallbackClearFields As CallbackObject Private m_formEx As FormEx Private m_fieldNames As ArrayEx
'/** ' * Constructor ' * @param formEx - current formEx object ' * @param fieldNames - names of fields which must be cleared ' */ Sub New(formEx As FormEx, fieldNames As ArrayEx) Set m_formEx = formEx Set m_fieldNames = fieldNames End Sub '/** ' * Invokes callback: clear all defined fields ' * @param params - arguments (not used) ' * @return Variant - result of invoking (not used) ' */ Public Function invoke(params As DynamicArguments) As Variant On Error Goto catch Dim i As Integer Dim control As ControlEditable For i = 0 To m_fieldNames.length - 1 Set control = m_formEx.FormManager.getControl(Cstr(m_fieldNames.Item(i)))
If Not control Is Nothing Then control.Value = "" Else m_formEx.DocumentEx.Property(Cstr(m_fieldNames.Item(i))) = "" End If Next Call m_formEx.Form.Refresh() finally: Exit Function catch: LogMsg "CallbackClearFields.invoke", "Exception " & Err & ": " & Error & " in line " & Cstr(Erl), LOG_LEVEL_ERROR Resume finally End Function End Class
- Locate the InitControls procedure in the
FormOpportunityEx class and add the following code:
Dim controlChannelType As New ControlEditable("JVDHierParent", Me.Form) Set callback = New CallbackClearFields(Me, NewSmartArray.Add("JVDHierChild")) Call controlChannelType.OnChange.Connect(callback) Call Me.FormManager.RegisterControl(controlChannelType)
- Save and close the SBL.Forms script library.
- Open the (SBL)form:opportunity form in IBM Domino Designer.
- Locate the JVDHierParent field and input the following code in the Onchange event:
Sub Onchange(Source As Field) Call cOnChange(m_FormHandler, "JVDHierParent") End Sub
- Locate the JVDHierChild field and modify the following parameter properties:
Refresh choices on document refresh - yes Note that field's choices parameters should contain valid @-formulas to make them dependent.
Example of JVDHierParent field's choices formula: key:="JVD Hier Parent"; @DbLookup("":"NoCache";"";"SBLPicklistsOpportunity";key;3; [FailSilent]) Example JVDHierChild field's choices formula: key := JVDHierParent; @DbLookup("":"NoCache";"";"SBLPicklistsOpportunity";key;3; [FailSilent]) where: SBLPicklistsOpportunity - name or alias of the view which contains correspondent picklist records
- Save and close the Opportunity form.
- Upload and publish your work. Do Uploading and Testing Your Static Picklist.
- Test your work:
- Open the client and then navigate to the Opportunity form.
- Make sure the form displays the following picklists:
- Choose the Hier Parent picklist and make sure it includes the following values:
- Choose Parent 1 in the Hier Parent picklist.
Siebel CRM Desktop should automatically change the value for the Hier Child picklist to Child 1 of Parent 1.
- Choose the Hier Child picklist and make sure it includes the following values:
- Child 1 of Parent 1
- Child 2 of Parent 1
- Choose Parent 2 in the Hier Parent picklist.
Siebel CRM Desktop should automatically change the value for the Hier Child picklist to Child 1 of Parent 2.
- Choose the Hier Child picklist and make sure it includes the following values:
- Child 1 of Parent 2
- Child 2 of Parent 2
|