how to switch view from ui action
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi All,
How we can directly switch to a particular view from a ui action? Tried few scripts but not working as expected.
// Redirect to newly created record with view
var url = '/u_email_client.do?sys_id=' + response + '&sysparm_view=genai_standardquery&sysparm_clear_stack=true';
// window.top.location = url;
g_navigation.open(url);
//action.setRedirectURL(response);
//g_navigation.openRecord('u_email_client', response, 'genai_standardquery');
//g_navigation.openRecord('u_email_client', response, 'GenAI_StandardQuery');
//g_navigation.openRecord('u_email_client', response, 'BPO_HRquery');
//top.window.location = '/u_email_client.do?sys_id=' + response + '&sysparm_view=GenAI_StandardQuery';
// var url = new GlideURL(g_form.getTableName() + '.do');
// url.addParam('sys_id', g_form.getUniqueValue());
// url.addParam('sysparm_view', 'GenAI_StandardQuery');
// window.location.href = url.getURL();
//action.setRedirectURL(current.getTableName() + '.do?sys_id=' + current.sys_id + '&sysparm_view=' + viewName + '&sysparm_view_forced=true');
//var link ="u_email_client.do?sys_id="+response+"&sysparm_view=genai_standardquery";
Regards,
Jobin
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
but why?
where you require this? native or workspace?
Regards,
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
UI action for view change, not a good way mate. Use OOTB way only and avoid technical debt.
*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hello @jobin1 ,
Try this script and it only works for form button
var view_name = "default";
var tableName=current.getTableName();
var url = tableName + ".do?sys_id=" + current.sys_id + "&sysparm_userpref."+tableName+".view=" + view_name;
action.setRedirectURL(url);
