How to Default Global Search to "Companies"

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

One Response to “How to Default Global Search to "Companies"”

  1. Evert van Veenhuizen Says:

    The sample code to set the default Global Search to ‘Companies’ doesn’t work correct. I have made some changes to it to really make it work:

    Sub OnPortalLoaded(ParameterList)

    ….

    Dim objInput
    Set objInput = UIMaster.documentMenu.body.getElementsByTagName(“INPUT”)
    If objInput(0).value = “” Then
    objInput(0).select
    objInput(0).defaultValue = “Companies”
    objInput(0).title = “Companies”
    objInput(0).value = “Companies”
    End If

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s


%d bloggers like this: