Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

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

2 REPLIES 2

lauri457
Tera 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 from a field with the getTabNameForField method if needed.

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

Ankur Bawiskar
Tera Patron

@sparkles 

please share some screenshots for your tabs what you are referring?

 

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader