SetNamedSearch Method for a Business Component

The SetNamedSearch method sets the named search specification on a business component. This method does not return any Value.

Format

For VB Script:

BusComp.SetNamedSearch searchName, searchSpec

For eScript:

BusComp.SetNamedSearch ( searchName, searchSpec, [clearSearchSpec])

The following table describes the arguments for the SetNamedSearch method.

Argument Description

searchName

String that identifies the name of the search specification. A named search specification is identified by the searchName argument.

searchSpec

String that contains the search specification.

clearSearchSpec

Optional. Applicable only to eScript.

When a Named Search has been added, using the browser back/forward buttons creates a new instance of the Business Component in the script. This will clear the Named Search. Setting this parameter to false retains the Named Search. If you do not include this parameter, the Named Search is cleared.

The searchSpec argument works in the same way as the argument you use after the equal sign in a predefined query.

Usage

A named search specification is a type of search specification that Siebel CRM applies in conjunction with the existing search specification. It applies the named search specification every time it calls the ExecuteQuery method. For example, with a predefined query or with the search specification on a business component.

You can only modify a named search specification programmatically. You cannot use the administrative interface to modify a named search specification.

The ClearToQuery method does not clear the named search specification. To clear it, you must explicitly set the searchSpec argument to "". If Siebel CRM creates a new instance of a business component, then it clears the named search specification.

The searchSpec argument in SetNamedSearch is the same argument that is used after the equal sign in a predefined query. For details on how to set up the search specification, read the SetSearchExpr method and the SetSearchSpec methods of a Business Component.

Note: A Named Search will be cleared when script is re-executed by using the browser back/forward buttons or exporting the records resulting from the query after using SetNamedSearch. To retain the Named Search when using the browser back/forward button, use the third parameter clearSearchSpec and set it to false (case sensitive). When the syntax is checked, an error is displayed for incorrect values.

A Named Search specification will be cleared when the clearSearchSpec argument is set to "true".

For VB Script, the argument clearSearchSpec has no effect. Thus, there is no need to use this parameter.

Using the SetNamedSearch method to define a search does not create a predefined query; this is a search specified in script only. To return this search specification, you can use the GetNamedSearch method. To return the values of an attribute in a user profile, Personalization uses the GetProfileAttr method.

Used With

COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script

Examples

The examples in this topic set a named search specification for a business component depending on the position of the current user.

The following example is in Siebel eScript. It uses the third parameter to retain the Named Search by setting it to false even when the browser back/forward buttons are used.

function BusComp_PreQuery ()
{
 if (TheApplication().GetProfileAttr("Position") == "Siebel Administrator");
 {
  this.SetNamedSearch ("Candidates", "[Status] LIKE 'Candidate'", false);
 }
 return (ContinueOperation;
}

The following example is in Siebel VB:

Function BusComp_PreQuery () As Integer
   If TheApplication.GetProfileAttr("Position") = "Siebel Administrator" Then
      Me.SetNamedSearch "Candidates", "[Status] LIKE 'Candidate'"
End If

BusComp_PreQuery = ContinueOperation
End Function
For more information, see SetSearchExpr Method for a Business Component and SetSearchSpec Method for a Business Component.