Login / Register  search  syndication  about

          Kris Halsrud's Blog

Kris Halsrud on development and Integration with CRM and Development

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 restrict the results in the group.  The filter options are stored for the user in the database VFS table so that the next time the group is opened, the filters remain active.  The only problem with this approach is it is easy to forget that a filter has been applied to a group and therefor questions arise as to why records can't be seen. I am going to explain how you can modify the filter task pane so that a label appears once you set a filter for a group.

 The first thing to understand is where we will be making the change.  The task pane is the right hand side of the SalesLogix web client.  One of the components loaded into the task pane is the filter smart part.  This is a custom smart part that renders the appropriate filters based on the entity the user is on and what columns are in the current group. This smart part is located in the Application Architect under Portal Manager...Sage SalesLogix...SupportFiles...SmartParts...TaskPane..Filters.  There is both a Filters.ascx and Filter.ascx.cs file that need to modified.

Let's take a look first at modifying the markup file Filters.ascx.  At the top of this file we want to add markup for an ASP.Net label.  Here is the markup with our element added (shown highlighted):

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Filters.ascx.cs" Inherits="SmartParts_TaskPane_Filters" %>
<div style="display:none">
    <asp:Panel ID="Filters_RTools" runat="server">
        <asp:HyperLink runat="server" ID="edit" Text="edit" CssClass="filter-edit"></asp:HyperLink>       
    </asp:Panel>
</div>
<asp:Label ID="FiltersActive" runat="server" Text="Filters Active" ForeColor="Red"></asp:Label>

Below where we just added our label is an existing javascript function.  We want to modify this code by inserting the code shown highlighted below:

    Sage.PopulateFilterList = function () {
        var GroupContext = Sage.Services.getService("ClientGroupContext");
        if ((typeof GroupContext === "undefined") ||
        (typeof Filters === "undefined") ||
        (typeof GroupContext.getContext().CurrentActiveFilters === "undefined")) {
            //|| (Filters._groupContextService.getContext().CurrentName != GroupContext.getContext().CurrentName)) {
            window.setTimeout(Sage.PopulateFilterList, 20);
            var af = document.getElementById('ctl00_TaskPane_item_Filters_Filters_FiltersActive');
            if (af) af.style.display = 'none';
        } else {
            var af = document.getElementById('ctl00_TaskPane_item_Filters_Filters_FiltersActive');
            if (af) af.style.display = 'none';
            var svc = Sage.Services.getService("GroupManagerService");
            if (svc) {
                svc.clearDistinctValuesCache();
            }
            var filterMgr = Sage.GetCurrentFilterManager();
            var args = GroupContext.getContext().CurrentActiveFilters;
            if (args) {
                var af = document.getElementById('ctl00_TaskPane_item_Filters_Filters_FiltersActive');
                if (af) {
                    if (args == "")
                        af.style.display = 'none';
                    else
                        af.style.display = 'block';
                }
                $("div.LookupFilter input", filterMgr._context).each(function () {
                    this.value = '';
                });

This code looks for the label element on the user control and based upon some conditions sets the style "Display" attribute to control the visibility.  This element is a control we added at the top of the ascx file.

Now we need to switchover to the code file Filters.ascx.cs.  on the Page_load event, more javascript code is injected onto the page.  In the existing code look for a line declaring a HyperLink that looks like this:

        HyperLink clear = new HyperLink();

Below that line, we need to add a new line:

        string CFXscript = "var af = document.getElementById('ctl00_TaskPane_item_Filters_Filters_FiltersActive'); if(af) af.style.display = 'none';";

This line is creating a string consisting of javascript that again sets an element's display style based on a condition. Here is that excerpt of code with the changes shown highlighted:

        HyperLink clear = new HyperLink();
        string CFXscript = "var af = document.getElementById('ctl00_TaskPane_item_Filters_Filters_FiltersActive'); if(af) af.style.display = 'none';";
        clear.NavigateUrl = string.Format("javascript:" + CFXscript + "{0}.ClearFilters();", ID);
        clear.Text = GetLocalResourceObject("Clear_Filters").ToString();
        clear.Attributes.Add("style", "display: block; margin-bottom: 0.5em");
        this.Controls.Add(clear);

The result of this small amount of code will now display a label at the top of the filter task pane that shows whenever a group has an active filter in place for it.

 

 

What's This?
  
Bookmark and Share

About Kris Halsrud

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


Related Content
   Infor CRM (Formerly Saleslogix) Iterating through all tabs on a Page
 Using the TabWorskpace you can iterate through all the tabs on a page and do something with them, l
Posted on Jun 19, 2015 by Kris Halsrud to Kris Halsrud's Blog
 
   Infor CRM (Formerly Saleslogix) Hiding Tabs at Runtime Without Using Modules
 As Ryan wrote a long time ago, you can create a module and add it to a page in the Infor CRM web cl
Posted on Jun 10, 2015 by Kris Halsrud to Kris Halsrud's Blog
 
   How I assign ownership to a group of Leads in Infor CRM?
There is a tool within Infor CRM to align Accounts to different Account Owners. It is called Territory Re
Posted on Jun 05, 2015 by Dale Richter to Infor CRM Questions & Answers
 
   Infor CRM (Formerly Saleslogix) Adding a Client Side Confirmation on a Dependency Lookup in the Web Client
 We recently had a client who wanted to have a user confirmation prompt before a user was allowed to
Posted on May 28, 2015 by Kris Halsrud to Kris Halsrud's Blog
 
   Infor CRM (Formerly Saleslogix) Embedding quickforms on quickforms
 I recently had a client who needed to have a lot of elements on a form.  They wanted a kind of
Posted on May 20, 2015 by Kris Halsrud to Kris Halsrud's Blog
 
Comments

 

rimonabantexcellence site title said:

Pingback from  rimonabantexcellence site title

June 3, 2013 7:25 AM

Leave a Comment

(required)  
(optional)
(required)  
Add
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