Setting The Active or Default Tab on a Page in Infor CRM Web

In Infor CRM Web (Saleslogix), when a user navigates to a page, there might be times when you want to draw attention to a particular tab. There are some options for specifying the active/displayed tab on the page. Let’s take a look at some of the options.

Specifying the Active Tab in the URL

You can add a parameter to the query string, or URL, to set the active/displayed tab. The activeTab parameter allows you to specify a tab by it’s ID (the ID is set when the SmartPart is added to a page. Look at the SmartParts for the page and you’ll see it’s “Smart Part ID” there).

For example, when redirecting a user to the Account page, if you want to display the Assets tab, you can use the following URL:

http://localhost:3333/SlxClient/Account.aspx?entityid=AGHEA0002669&activeTab=AccountAssets

It doesn’t matter if the tab is in the More Tabs, or it’s own tab, it will display as the active tab.

Programmatically Setting the Active tab

You can also set the active tab on demand from a LoadAction or other event or control change action. To do this, you’ll need to inject some Javascript onto the page. Also, since a tab can either be a real tab, or can be located under the “More Tabs” tab, you’ll need the Javascript check to see where the tab is at. If the tab is under the More Tabs tab, you’ll need to also activate the “More Tabs” tab first, and then activate the tab you want to show. That sounds more complicated than it is. The code looks like this (in this sample, we’re showing the Assets tab again:

// Server-side code for adding to LoadAction or control change action

// this is the ID of the tab you want to show
var tabIdToSelect = "AccountAssets"; 

// leave these lines as they are
var script = "var prefix = 'show'; if ($('#show_More').nextAll('#show_" + tabIdToSelect + "').length) { $('#show_More').click(); prefix = 'more'; } $('#' + prefix + '_" + tabIdToSelect + "').click();";
ScriptManager.RegisterClientScriptBlock(this, GetType(), "tabSelect_Script", script, true);

That code can be added in a LoadAction or change event of a control. This comes in handy when you want to conditionally show a certain tab.

If you need to set the active tab via client-side Javascript, the code looks like this (same code as above, just with the server-side stuff removed)

// Client-side javascript 

// this is the ID of the tab you want to show
var tabIdToSelect = 'AccountAssets'; 

var prefix = 'show'; 
if ($('#show_More').nextAll('#show_' + tabIdToSelect + '').length) { 
	$('#show_More').click(); prefix = 'more';
} 
$('#' + prefix + '_' + tabIdToSelect).click();

Specifying the Default Tab for the Page

If you always want a certain tab to show for a page, you can set that for the page itself in Application Architect. To set this, open the page in AA, click the “Configure” button in the Template Information section, then set the tab’s ID as the value for the OverrideActiveTab property. See the following screenshot:

ABOUT THE AUTHOR

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix since 2001 and believes in sharing with the community. He loves C#, Javascript, Python, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) news and product updates!

You have Successfully Subscribed!