Login / Register  search  syndication  about

          Kris Halsrud's Blog

Kris Halsrud on development and Integration with CRM and Development

SalesLogix Web 7.5.3 error “object reference not set to an instance of an object” when navigating to a main view

In the SalesLogix 7.5.3 web client, when you navigate to a main view you might receive an error stating “Object Reference not set to an instance of an object”.  There are many things that might cause this.  If you look in the web server’s event logs, under the Application events you should see an error logged.

Recently, I ran into one such error where the stack trace was something like:

2010-12-30 09:31:19,235 ERROR Global – Unhandled exception. System.Web.HttpUnhandledException: Exception of type ‘System.Web.HttpUnhandledException’ was thrown. —-> System.NullReferenceException: Object reference not set to an instance of an object. at SmartParts_TaskPane_CommonTasks_CommonTasksTasklet.DetermineAdHocStatus() at SmartParts_TaskPane_CommonTasks_CommonTasksTasklet.OnPreRender(EventArgs e) at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)—- End of inner exception stack trace—- at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.role_aspx.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

 

This error points out the offending area was the CommonTasksTasklet, specifically the method DetermineAdHocStatus().  This method is defined on the CommonTasksTasklet.ascx.cs file which is a custom smart part under SmartParts/Taskpane/CommonTasks.

 

This method loops through the CurrentGroupConext collection to find the current group and see if it is an ad-hoc group or not.  The only problem is the code does not check to see if the CurrentGroup list context is null.  The code current code looks like:

private void DetermineAdHocStatus()
{
    GroupContext groupContext = GroupContext.GetGroupContext();
    string currentGroupID = groupContext.CurrentGroupID;

    foreach (GroupInfo gi in groupContext.CurrentGroupInfo.GroupsList)
    {
        if (gi.GroupID == currentGroupID)
        {
            if ((gi.IsAdHoc) ?? false)
            { _currentIsAdHoc = true; }
        }
        if ((gi.IsAdHoc) ?? false)
        { _contextHasAdHoc = true; }
        break;
    }
}

It should be something like:

private void DetermineAdHocStatus()
{
    GroupContext groupContext = GroupContext.GetGroupContext();
    string currentGroupID = groupContext.CurrentGroupID;
    if (groupContext != null && groupContext.CurrentGroupInfo != null)
    {
        foreach (GroupInfo gi in groupContext.CurrentGroupInfo.GroupsList)
        {
            if (gi.GroupID == currentGroupID)
            {
                if ((gi.IsAdHoc) ?? false)
                { _currentIsAdHoc = true; }
            }
            if ((gi.IsAdHoc) ?? false)
            { _contextHasAdHoc = true; }
            break;
        }
    }
}

So the code above should prevent the error in the first place, but the real reason for this error is that the main view the user is navigating to does not have a group defined or a group defined released to the user.  When the code tries to loop through the current group collection it errors out because there is no current group collection.

What's This?
  
Bookmark and Share

About Kris Halsrud

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


Related Content
   Adding Filters to the Lookup Control at Runtime in the Infor CRM (formerly Saleslogix) Web Client
To add a new Lookup Pre-filter you can add code such as this on a quick form:LookupPreFilter preFilter =
Posted on Dec 22, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Easily Showing and Hiding Tabs at Runtime in Infor CRM (Saleslogix)
Showing and hiding tabs in the Infor CRM (Saleslogix) client should be an easy thing. It should be someth
Posted on Dec 16, 2014 by Ryan Farley to Ryan Farley's Blog
 
   Problem setting SLXTextbox enabled property / Setting unexposed base control properties for a custom control
I recently had an issue with a Quickform where I was attempting to set the Enabled property of a TextBox
Posted on Dec 05, 2014 by Jason Buss to Jason Buss' Blog
 
   Checking Infor CRM (Saleslogix) Picklists for valid data
This week I received a question about a particular picklist. One of the picklist items, when chosen, wou
Posted on Dec 05, 2014 by Dale Richter to Infor CRM Questions & Answers
 
   Avoiding the Dirty Data Message When Programatically Redirecting to a Record in Infor CRM (Saleslogix)
In my last post I wrote about using the OnClientClick property of a control (or button) to run JavaScript
Posted on Dec 02, 2014 by Ryan Farley to Ryan Farley's Blog
 
Comments

 

Twitter Trackbacks for SalesLogix SalesLogix Web 7.5.3 error ???object reference not set to an instance of an object??? when navigating to ... [customerfx.com] on Topsy.com said:

Pingback from  Twitter Trackbacks for                 SalesLogix SalesLogix Web 7.5.3 error ???object reference not set to an instance of an object??? when navigating to ...         [customerfx.com]        on Topsy.com

December 30, 2010 9:38 PM
 

José Ureña said:

Lol... Be careful with the If... should be if or you'll get an error!

July 7, 2011 5:44 PM
 

Kris Halsrud said:

Thanks Jose, stupid auto formatting capitalized that.  Corrected now.

July 8, 2011 8:29 AM

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