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 switch view from ui action

jobin1
Tera Expert

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

6 REPLIES 6

Aditya_hublikar
Mega Sage

Hello @jobin1 ,

 

You can acheive this requirnment using below ui action .

switchView.png

Here v1 is my viewName (Note : I tried above ui action in xanadu version)

 

I recommend you don't try to change view like this means using ui action. In Servicenow there is ootb option to change view always try to use that .

 

 

If this helps you then mark it as helpful and accept as solution.

Regards,

Aditya

 

Hello @jobin1 ,

 

I hope you are doing well. Does your query is resolved ?

 

If my response helps you then mark it as helpful and accept as solution.

Regards,

Aditya