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
   Error Attempting to Save an Entity: "E_FAIL(0x80004005)" in the Infor CRM (Saleslogix) Web Client
We recently had a client that was running into an issue when attempting to create one particular entity i
Posted on Sep 30, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Video: Demystifying Infor CRM (Saleslogix) Updates
Watch it now! If you missed yesterdays demo, "Demystifying Infor CRM (Saleslogix) Updates" ,
Posted on Sep 26, 2014 by Brianna Ojard to The Inbox
 
   Official Infor CRM Acquisition FAQ
What to expect now that Saleslogix is Infor CRM. Like many of you, it will take some time (probably a
Posted on Sep 18, 2014 by Brianna Ojard to The Inbox
 
   Problem with the Clean Build Folders option in Application Architect
On occasion, it becomes necessary to clean out the build folders and deployed website prior to a build/de
Posted on Sep 16, 2014 by Jason Buss to Jason Buss' Blog
 
   Restricting Adding Opportunity Contacts to Contacts at the Opportunity's Account
 One thing that clients have asked for is how to restrict the selection of the Opportunity Contacts
Posted on Sep 09, 2014 by Kris Halsrud to Kris Halsrud's 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