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
   Infor CRM (formerly Saleslogix) Web- Dependency Lookup OnChange Event Not Working Correctly
In the Saleslogix 8.1 web client the dependency lookup still has a problem with the OnChange event. 
Posted on Nov 26, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Confirming Actions With an "Are you sure?" Prompt in Infor CRM (Saleslogix)
I'm not a huge fan of bugging end users. I figure, if an end user clicked something, he or she meant
Posted on Nov 18, 2014 by Ryan Farley to Ryan Farley's Blog
 
   Manipulating the DependencyLookup Control in the Infor CRM Web Client (Formerly Saleslogix)
 The Dependency Lookup control in the Saleslogix web client is what is used for the hierarchical Are
Posted on Nov 14, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Infor CRM (formerly Saleslogix) Statement of Direction
Learn more about the future of Infor CRM. Recently I received my login information for the Infor Partn
Posted on Nov 13, 2014 by Brianna Ojard to The Inbox
 
   Adding a report link to the Common Tasks pane in Infor CRM (formerly Saleslogix)
When you are viewing an Entity Detail page, the Common Tasks pane on the right of the page provides a nu
Posted on Nov 12, 2014 by Jason Buss to Jason Buss' 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