You can call a searchlist and render the results pretty easily in BBIS through a combination of code generation and web service calls.
Here’s how it works:
A – Use the BBMetalWeb tool to generate code for two things:
1 – Your searchlist
2 – The view form that renders results associated with that searchlist
A guide to using BBMetalWeb is in your sdk\documentation folder in a document called “BBMetalWeb.docx”.
I’ve also attached another guide that you may find helpful.
B – Access those features from BBIS
Once you’ve included the codegen files in your BBIS project, you are ready to go.
The below example code searches for all individual constituents and dumps them into a ListBox.
That example should be fairly easy to adapt to a variety of scenarios.
Private Sub RefreshList() 'retrieves all individual constituents and drops them into a Listbox Try lbxConstituents.Items.Clear() 'you have lots of filter options (ex: keyName). in this example, i'll pull all individuals. Dim filter As New SearchLists.Constituent.ConstituentSearchFilterData filter.INCLUDENONCONSTITUENTRECORDS = False filter.INCLUDEORGANIZATIONS = False filter.INCLUDEINACTIVE = False filter.INCLUDEGROUPS = False filter.INCLUDEDECEASED = False filter.INCLUDEINDIVIDUALS = True 'this request is optional. you *can* pass the filter directly into the GetIDs method. 'but if you do that, you have to accept the default maximum of 100 rows returned. Dim req As New Blackbaud.AppFx.WebAPI.ServiceProxy.SearchListLoadRequest req.SearchListName = "Constituent Search" 'you can also specify the searchlistid, but the name is more readable req.SecurityContext = New Blackbaud.AppFx.WebAPI.ServiceProxy.RequestSecurityContext() req.ClientAppInfo = Me.API.AppFxWebServiceProvider.CreateClientAppInfoRequestHeader req.MaxRecords = 10000 'default is to cut off at 100 records, but we'll override that req.Filter = filter.BuildDataFormItemForFilter 'attach the filter conditions to the request 'now grab the results and stuff them into a string array 'the results are simply a list of GUIDs corresponding to the matching records returned by the searchlist 'to actually view the record, you have to call a view form Dim results As String() = SearchLists.Constituent.ConstituentSearch.GetIDs(Me.API.AppFxWebServiceProvider, req) 'loop through each returned ID and use the view form to pull additional information 'in this example, we'll just dump them into a listbox. For Each constitResult In results Dim frm As ViewForms.Constituent.ConstituentPageExpressionViewFormData = _ ViewForms.Constituent.ConstituentPageExpressionViewForm.LoadData(Me.API.AppFxWebServiceProvider, constitResult.ToString) lbxConstituents.Items.Add(New ListItem(frm.NAME, constitResult.ToString)) Next Catch ex As Exception Throw ex End Try End Sub