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
   Editing Filters in Saleslogix Web Client 8.0
Is it possible to add or remove Saleslogix filters from the List view in Accounts?
Posted on Apr 08, 2014 by SalesLogix Support to SalesLogix Questions & Answers
 
   Bug in the Saleslogix Web LiveGrid Lookup dialog
I recently ran into an issue with the Opportunity Products grid in the Saleslogix web client.  I cli
Posted on Apr 04, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Saleslogix Web Client Controls are Missing
Every so often we hear that a user can no longer add products to an opportunity whether it is a new oppor
Posted on Mar 24, 2014 by Mark Duthoy to SalesLogix Support
 
   Major Problem in Saleslogix v8.1 Cloud Instances
I have been working with a new client who is on the hosted cloud solution for Saleslogix version 8.1.&nbs
Posted on Mar 19, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Setting the Defaults on the Insert Account/Contact Duplicate Record View
When creating a new Account/Contact record in Saleslogix web, you have the ability to check for duplicat
Posted on Mar 10, 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