Using the TabWorskpace you can iterate through all the tabs on a page and do something with them, like show or hide them. To do this you need the following code:
private Sage.Platform.Application.UI.UIWorkItem _parentWorkItem;
[Sage.Platform.Application.ServiceDependency(Type = typeof(Sage.Platform.Application.WorkItem))]
public Sage.Platform.Application.UI.UIWorkItem ParentWorkItem
{
get
{
return this._parentWorkItem;
}
set
{
this._parentWorkItem = value;
}
}
protected void QuickFormLoad0()
{
Sage.Platform.WebPortal.Workspaces.Tab.TabWorkspace tabContentWorkspace = null;
try
{
string id = string.Empty;
tabContentWorkspace = this._parentWorkItem.Workspaces["TabControl"] as Sage.Platform.WebPortal.Workspaces.Tab.TabWorkspace;
Sage.Platform.Application.IEntityContextService entityContext = this._parentWorkItem.Services.Get<Sage.Platform.Application.IEntityContextService>();
if (entityContext.HasEntityContext)
{
id = entityContext.EntityID.ToString();
}
Sage.Entity.Interfaces.IAccount buyer = Sage.Platform.EntityFactory.GetById<Sage.Entity.Interfaces.IAccount>(id);
if (tabContentWorkspace != null && buyer != null)
{
foreach (Sage.Platform.WebPortal.Workspaces.Tab.TabInfo sp in tabContentWorkspace.Tabs)
{
tabContentWorkspace.Hide(sp.ID, true);
}
}
}
catch { }
}




Hi Kris,
For the Account page, what quick form’s Load action holds the code snippet? QuickFormLoad0 of AccountDetails OR QuickFormLoad0 of any tabs?
Thanks
xdp
It would be a load action on the Account Details quick form you would want to add it to. Please be aware though that in newer versions of Infor CRM web this no longer works to show or hide tabs. I think this approach worked in pre 8.1. See this post: http://customerfx.com/article/infor-crm-formerly-saleslogix-hiding-tabs-at-runtime-without-using-modules/
Our Infor CRM web is 8.3. Actually, I want to customize the code to set default tab. For example, when opening Account page, the Contacts tab is displayed by default. Is it possible?
The default tab is based on settings stored in the VFS table for each user. The path for this setting in the VFS for the admin user would be: \Configuration\Application_User\SlxClient\admin\ASP.account_aspxDetail\TabWorkspace-E53DA2EE-942A-4b9d-8885-55C2EF1A4E4A.xml
Inside the xml of that is a node ActiveMainTab which stores the smart part name of the tab that is defaulted.
I think you would somehow need to update this VFS record for each user on the load of the account form. I am not sure if that would happen early enough to make the tab the active one or if it would happen too late. Never tried doing this specifically.
Using your code for hiding/showing tabs, we can get the tab collection of the current Account, right? From the tab collection, is it possible to locate a certain tab which we want and then set it as displayed (active?) with code (e.g. a method) on the fly?
Not sure but I doubt it. The tab selection is client side and this would be server side code. I would guess the only server side way would be as I mentioned to change the default tab in the VFS settings prior to the tabs being opened. Perhaps with client side jscript you could do so, but not sure.
Thanks Kris!
foreach (Sage.Platform.WebPortal.Workspaces.Tab.TabInfo sp in tabContentWorkspace.Tabs)
———————————-
tabContentWorkspace.Tabs is a tab collection, right?
For this line, sp is Tabinfo. Is there a method or property which can return tab?
Or tabContentWorkspace is that tab collection?
Maybe can use tabContentWorkspace.Activate(object smartpart), but don’t know how to get/create the smartpart object, e.g. the object of Contacts quickform.