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
   Configuring and Packaging secured actions in Saleslogix 8.0
Using Secured Actions, you can restrict access to user interface elements in the Saleslogix web client.
Posted on Aug 12, 2014 by Jason Buss to Jason Buss' Blog
 
   How do you add a parameter for File Attachment Size and Timeout in Saleslogix 8.1?
Question: Is it possible to set a parameter for file attachment size and timeout in Salelogix? If
Posted on Aug 07, 2014 by Dale Richter to SalesLogix Questions & Answers
 
   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
 
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