
I wanted to go back to Ryan’s earlier post where he shows how to use a Module to hide components of the SalesLogix web client. One word of warning on this code is that these modules also run when the Web Reporting server launches the report viewer. Since these report viewer does not have the same workspaces as the web client you need to make sure you include proper validations in the code to ensure that the workspaces you are referencing exist:
Ryan’s code:
using Sage.Platform.WebPortal.Workspaces; using Sage.Platform.WebPortal.Services; using Sage.Platform.WebPortal.SmartParts; //... // Get the ToolbarWorkspace ToolbarWorkspace toolbar = _parentWorkItem.Workspaces["ToolBar"] as ToolbarWorkspace; // Get the MenuService for the ToolbarWorkspace IMenuService menusvc = toolbar.WorkItem.Services.Get<IMenuService>(); // Find the "Tools" menu by it's ID NavItemCollection navcol = menusvc.FindMenu("mnuTools") as NavItemCollection; if (navcol != null) { // Remove the "Import Leads" menu by using it's ID navcol.RemoveItem("tools_ImportLeads"); } |
Proper code:
using Sage.Platform.WebPortal.Workspaces; using Sage.Platform.WebPortal.Services; using Sage.Platform.WebPortal.SmartParts; //... // Get the ToolbarWorkspace ToolbarWorkspace toolbar = _parentWorkItem.Workspaces["ToolBar"] as ToolbarWorkspace; if(toolbar==null) return; // Get the MenuService for the ToolbarWorkspace IMenuService menusvc = toolbar.WorkItem.Services.Get<IMenuService>(); if(menusvc==null) return; // Find the "Tools" menu by it's ID NavItemCollection navcol = menusvc.FindMenu("mnuTools") as NavItemCollection; if (navcol != null) { // Remove the "Import Leads" menu by using it's ID navcol.RemoveItem("tools_ImportLeads"); } |
If you don’t do this you will get an error launching the report viewer along the lines of “We apologize for the inconvenience, but your request could not be completed, Object reference not set to the instance of an object.”
Subscribe To Our Newsletter
Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!
You have Successfully Subscribed!