The SalesLogix web client uses the ext-js library for the SalesLogix groups. Finiding out what records are selected in the group is not that obvious. This post will walk you through what you need to do in order to determine what records are selected.

Determining record selected is really a two step process – the first is a client side call to set a SalesLogix client side library with the records selected, the second part is to actually do something with them. The client side library does expose working with the records selected, but I am going to show you how to use the client side selected records to do something server side.

The first step is to create the client side function to store the selected records. In this example I am going to add a task to the common task area of the task pane. Because of this I will be adding my client side function right to the CommonTasksTasklet.acsx file. In the existing javasript tag of the ascx file I will create the following function:

This function uses the SelectionContextService and sets the current selections into it.

Now on the ascx.cs file we need to do two things:

Create a task on the common task area to that can invoke an event after I select my records.

Wire up the server side code to do something with the selected records.

The first thing I am going to do is add a common task to the Account area. This is done in the FillListViewDictionaries method. If you look the first block of code is defining the account list tasks. I am going to add the line of code shown below in bold. Make note that the tasks are comma delimited so you need to change the existing last task’s line to remove “};” and change it to “,”

Also, make not that the second parameter is a string corresponding to an entry in the ascx resource file. You will need to add an entry corresponding to this in the resource file. I will not go over this here.

As you can see, the third parameter in the line added is a call to my custom client side function. As of right now we have a working page but it will not do anything until we wire up the server side code. To do this we need to look for a method in the cs file called “items_ItemCommand”. In this method is a large case statement that determines which task is clicked based on the task name (parameter 1 in the FillListDictionaries method). Here we will add a new case block of code at the end of the existing code like so:

case “tskTest”: tskTest_Command(); break;

Here I am invoking a new method called “tskTest_Command”. Lets create that now.