How to direct the user to a specific section of the form (server side) onload

sparkles
Tera Contributor

Hi,

 

I have a form with 7 tabs, each tab has business line. When ticket is created, an email sent to the business line manager with the link to the ticket he needs to action on it. I want a way so when the business line manager click on the link it takes him to his designated business line tab.

I tried the business rule but it didn't work

var recordSysId = current.getUniqueValue(); // Get the current record's sys_id
var tableName = current.getTableName(); // Get the current table name
var redirectUrl = "/" + tableName + ".do?sys_id=" + recordSysId + "&sysparm_active_section=**section_abcd**";

gs.setRedirect(redirectUrl);

 

Thanks,

S

1 REPLY 1

lauri457
Giga Sage

If sysparm_active_section was a real url parameter you could just include it in the link, no need to use brs. But I'm not sure it actually exists.

 

You can use the activateTab(field: string) method of g_form to focus on a section tab by name, you can get the tab name with getTabNameForField.

function onLoad() {
	const params = new URLSearchParams(window.location.search);
	const section = params.get("sysparm_active_section");

	g_form.activateTab(section);
}

 

Or you can do it by index

g_tabs2Sections.setActive(1)

 

Not sure about your use case but you might also want to consider views which you can set by the sysparm_view parameter. This can possibly make for better ux