When to use Named Search Spec?

Named Search Specification is a powerful little feature that is hidden away. It enables you to programmatically set the search specification relation to that cannot be cleared from the UI.

All you need to do is write the following piece of code in your script -

function BusComp_PreQuery ()
{
   if (TheApplication().GetProfileAttr("Position Type") == "External Partner") {
      this.SetNamedSearch ("External Partner", "[Type] <> 'Internal'");
   
   return (ContinueOperation);
}

The above example shows the named search specification set in the PreQuery event.

Once this is executed, external partners cannot see records of type “Internal”.

You use a named search specification when you do not want any of the user queries to clear the filter criteria that has already been set through the script. The predefined search criteria will be applied to any user initiated queries - maybe through PDQ, new search, and even after navigation across screens.

Once defined the named service specification is applicable for that instance of the business component. It may be applicable when the BC is being instantiated through Applets, Picklists, scripts or from any other object.

Alternate ways of setting filter criteria like SetSearchSpec, SetSearchExpr will be cleared once the user hits the “query” button, or selects a PDQ.

You can clear the named such specification by retrieving the name of the search spec, and clearing it explicitly.

You can retrieve the server specification for future programmatic uses by using the following statement-

bcOpty.GetNamedSearch ("External Partner");
Tags :
    Comments powered by Disqus

    Related Posts

    Retrieve SFDC Attachments using REST

    Salesforce changed the way files are managed with Lightning Spring 17 release, and this introduced a more elaborate procedure to reach the files from external systems.

    Read More
    Small data - Why does it not make sense?

    Small data - Why does it not make sense?

    The world loves its terminologies and nomenclature. IT and CRM are no exception.

    Read More
    Airtel's not-so-bright customer story

    Airtel's not-so-bright customer story

    As most of us here in India understand, customer service is not on top of the list of any of the ‘mass’ service providers.

    Read More