Saturday, February 20, 2010

SetNamedSearch - Cannot be modified through UI

Have you come across a requirement where after reaching a view. You don't want user to do a new query and get all the records. You only want to show those records which user saw first time on reaching to this view.
Though you want to give him a query option to search in the given records first time.

Yes, this can be achieved using SetNamedSearch BusComp Method. 

Let me explain you with the help of a example.
Using a Drilldown, user reached to a All Activities List View where I don't want him to see Confidential Activities. I captured the method Drilldown and the Field name using SWEField property, in the drill down only I put code like

BusComp.SetNamedSearch(searchName, searchSpec)

SetNamedSearch("NotConfidential", "[Confidential] != 'Y'")
GotoView(ViewName, BO instance)

Now even after reaching to the DrillDown View, if user do a null query. He will not be able to see the confidential activities.

It is a search criterion that is not cleared by the ClearToQuery; for example, a predefined query or business component search specification.It can only be modified through script; it cannot be modified through the UI. 

You can retrieve this search specification, use GetNamedSearch metho.

Note: that when a new instance of the BusComp is created, the named search specification is cleared.

No comments:

Post a Comment