Login / Register  search  syndication  about

          Kris Halsrud's Blog

Kris Halsrud on development and Integration with CRM and Development

SalesLogix Web Client – Determining the selected records in the list view

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:

function FXGetSelections(){
    var selectionInfo = GetSelectionInfo();
    document.getElementById(clientID + '_hfSelections').value = selectionInfo.key;
    var svc = Sage.Services.getService('SelectionContextService');
    svc.setSelectionContext(selectionInfo.key, selectionInfo, false);

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

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

  1. Create a task on the common task area to that can invoke an event after I select my records.
  2.  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 “,”

         string[,] accountListTasks =
            {{"tskAddToGroup", "TaskText_AddToGroup","javascript:showAdHocList(Ext.EventObject);", "false"},
             {"tskPromote", "TaskText_Promote", "javascript:promoteGroupToDashboard();", "false"},
             {"tskExportToExcel", "TaskText_Export", "javascript:exportToExcel();", "false" },
           {"tskTest","TaskText_Test","javascript:FXGetSelections()","false" }};
        tasksByEntityList.Add("IAccount", accountListTasks);

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":

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

    void tskTest_Command()
        GroupContextService groupContextService = ApplicationContext.Current.Services.Get<IGroupContextService>() as GroupContextService;
            CachedGroup currentGroup = groupContextService.GetGroupContext().CurrentGroupInfo.CurrentGroup;
            GroupInfo gInfo = currentGroup.GroupInformation;

            string passedArgument = hfSelections.Value;
        ISelectionService srv = SelectionServiceRequest.GetSelectionService();
        ISelectionContext selectionContext = srv.GetSelectionContext(passedArgument);
        IList<string> selections = selectionContext.GetSelectedIds();
        string msg = "";
        foreach (string id in selections)
            msg += id + ",";
        throw new Sage.Platform.Application.ValidationException(msg);

Here we have server side code working with the SelectionService that we populated client side.  In this case I am simply building a list of Ids selected and then displaying that list to the user.

There you have it.  A process for getting the client side selections in the SalesLogix group view and working with them server side!

What's This?
Bookmark and Share

About Kris Halsrud

   Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.

Related Content
   Calling refresh from the LinkHandler.cs Class
I recently had to figure out how to make the detail view in the SalesLogix 7.5.4 web client refresh after
Posted on Feb 01, 2013 by Kris Halsrud to Kris Halsrud's Blog
   Adding a label to show when filters are active in the SalesLogix web client
In the SalesLogix web client, users can set filters when looking at groups. These filters further restri
Posted on Jun 27, 2012 by Kris Halsrud to Kris Halsrud's Blog
   Accessing a user's Secured Actions to determine functionality in the SalesLogix web client
Since SalesLogix 7.5.3, SalesLogix has exposed user Roles and actions within the roles.  See this po
Posted on Nov 22, 2011 by Kris Halsrud to Kris Halsrud's Blog
   SalesLogix Web Manifest "wizards" buggy
I had a phone call yesterday with a client who was trying to use the Application Architect's manifest
Posted on Oct 28, 2011 by Kris Halsrud to Kris Halsrud's Blog
   Exporting dates as local time in the SalesLogix Web client when exporting groups to a file.
How to export data in the SalesLogix web client with dates in local times when exporting group informatio
Posted on Oct 12, 2011 by Kris Halsrud to Kris Halsrud's Blog


Twitter Trackbacks for SalesLogix Web Client ??? Determining the selected records in the list view - Kris Halsrud's Blog [customerfx.com] on Topsy.com said:

Pingback from  Twitter Trackbacks for                 SalesLogix Web Client ??? Determining the selected records in the list view - Kris Halsrud's Blog         [customerfx.com]        on Topsy.com

December 16, 2010 2:46 PM

Kris Halsrud's Blog said:

In a previous post , I talked about how you can access the client side group selection context to determine

October 14, 2013 12:10 PM

Leave a Comment

All contents Copyright © 2015 Customer FX Corporation
Customer FX Corporation
2324 University Avenue West, Suite 115
Saint Paul, Minnesota 55114
Tel: 800.728.5783

  Follow @CustomerFX on twitter
Follow the best news, tips, and articles
  Subscribe to Customer FX on youtube
Watch SalesLogix tutorial videos from Customer FX
Login / Register