Archive for May, 2008

How to Default Global Search to "Companies"

May 12, 2008

This is the sample code on how to default the Global Search to certain Business Object such as Companies.

ScreenShot005 

'***************************************************
' Name:     OnPortalLoaded
' -> Default the Global Search to "Companies" BO
'***************************************************
Sub OnPortalLoaded(ParameterList)    
    Dim objInput
    Set objInput = UIMaster.documentMenu. _ 
        body.getElementsByTagName("INPUT")
    objInput(0).Value = "Companies" 
    
    ....
    ....
    ....
End Sub


'***************************************************
' Name:     OnGlobalQuickSearchLoaded
' -> Handle the Companies Global Search to run
' Company Quick Search
'***************************************************
Function OnGlobalQuickSearchLoaded(vntParameters)
    Dim objInput
    Dim strSearchText
    Dim objSearchFactory
    
    On Error Resume Next
    
    Set objInput = UIMaster.documentMenu._ 
        body.getElementsByTagName("INPUT")
    
    If objInput(0).Value = "Companies" Then
        strSearchText = objInput(1).Value
        Set objSearchFactory = _ 
      UIMaster.CreateCenterReference("quicksearch")
        With objSearchFactory
            .SearchType = 1 'A non-global quick search.
            Set .Table = _ 
        UIMaster.RSysClient.GetTable("Company")
            .SearchText = strSearchText
        End With
        UIMaster.ShowCenterReference _ 
    actionAskUser, objSearchFactory, Null
    End If
    
    OnGlobalQuickSearchLoaded = True
End Function
Advertisements