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
   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
 
   How do I access the new Opportunity that I created in Saleslogix??
I had a user ask why they could not access a Salelogix opportunity when they clicked the hyperlink from t
Posted on Sep 04, 2014 by Dale Richter to SalesLogix Questions & Answers
 
   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
 
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