Login / Register  search  syndication  about

          Kris Halsrud's Blog

Kris Halsrud on development and Integration with CRM and Development

Globally filtering the Notes/History tab in the SalesLogix web client

 

In the SalesLogix web client, the Notes/History tab is largely based on client side binding.  The client side scripting handles the various functions the grid can perform like filtering.  One request I had recently is to globally filter the grid to exclude certain records regardless of what filers the users selected.  Now modifying the client side scripting could handle this, we can also do it a different way.

On the code file for the Notes History control (NotesHistoryList.ascx.cs) we see there is a OnFormBound event which is used to register a client side script onto the page:

 

protected override void OnFormBound()
   {
       base.OnFormBound();
       ScriptManager.RegisterClientScriptInclude(this, GetType(), "NotesHistoryList",
           Page.ResolveUrl("~/SmartParts/History/NotesHistoryList.js"));

       string scr = string.Format("Sage.UI.Forms.HistoryList.HistoryTypeMap = {{{0}}};", Server.HtmlEncode(BuildHistoryTypeMap()));
       ScriptManager.RegisterStartupScript(this, GetType(), "historyTypes", scr, true);

       var script =
           String.Format(
               @"window.setTimeout(function() {{ Sage.UI.Forms.HistoryList.init('{0}',
                   function() {{ return '{2} eq \'' + Sage.Utility.getCurrentEntityId() + '\''; }},
                   {{ workspace: '{1}', tabId: '{3}' }}); }}, 1);",
               placeholder.ClientID, getMyWorkspace(), GetParentField(), ID);

       if (!Page.IsPostBack)
       {
           script = string.Format("dojo.ready(function() {{ {0} }});", script);
       }
       ScriptManager.RegisterStartupScript(this, GetType(), "HistoryList_Init", script, true);
   }

If we modify the portion shown highlighted above we can pass in an additional criteria like so:

var script =
            String.Format(
                @"window.setTimeout(function() {{ Sage.UI.Forms.HistoryList.init('{0}',
                    function() {{ return '{2} eq \'' + Sage.Utility.getCurrentEntityId() + '\' and ({4})'; }},
                    {{ workspace: '{1}', tabId: '{3}' }}); }}, 1);",
                placeholder.ClientID, getMyWorkspace(), GetParentField(), ID, GetParentField() == "AccountId" ? "AttendeeHistory eq null or AttendeeHistory eq false" : "1 eq 1");

In this example we are checking to see what the GetParentField() function returns.  This function returns the key field used to filter.  In this case I only wanted to add a filter if we are on the Account screen (returns AccountId).  If it does we are adding an additional filter to look for a property called AttendeeHistory and only return null or false values. If not on the account screen, we are adding just a simple 1=1 statement to essentially not filter.

Adding a filter this way ensures it is globally applied even if the user chooses other filter options in the UI.

What's This?
  
Bookmark and Share

About Kris Halsrud

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


Related Content
   Saleslogix XBar Installation
When installing the new XBar application I found the instructions a little vague so I thought I would pas
Posted on Jul 18, 2014 by Mark Duthoy to SalesLogix Support
 
   Finding the Current Parent Record ID in SalesLogix Web
Sometimes it's the easiest things that can be a big barrier to entry for getting started with somet
Posted on Jun 27, 2014 by Ryan Farley to Ryan Farley's Blog
 
   SalesLogix 8.1 Job Service Scheduling Executions Error Resolution
Often times a web implementation will have an application server that is used to deploy the web portals t
Posted on Jun 20, 2014 by Mark Duthoy to SalesLogix Support
 
   Saleslogix 8.1 Web Access Tab Throws Null Reference Error
 I recently had a client experiencing a problem access the Contact's Web Access tab.  Whene
Posted on Jun 18, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Debugging Custom Assemblies Using Visual Studio
Developing for Saleslogix web using external assemblies provides you with a lot of freedom when developin
Posted on Jun 10, 2014 by Jason Buss to Jason Buss' Blog
 
Comments

No Comments

Leave a Comment

(required)  
(optional)
(required)  
Add
All contents Copyright © 2014 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