How to click a button to jump to a personalized screen?

shiz
Tera Contributor

shiz_0-1730362917590.png

How to click a button to jump to a personalized screen?
Instead of the default new screen

18 REPLIES 18

Hi @shiz ,

 

You can simple do like below.

 

 

top.window.location = "https://YourInstanceName.service-now.com/u_actual_times_details.do";  

 

 

 

To get the dynamic instance url you can do below.

 

Client script code

 

 

var ga = new GlideAjax('HelloWorld');
	ga.addParam('sysparm_name', 'helloWorld');

	ga.getXML(HelloWorldParse);

	function HelloWorldParse(response) {
		var answer = response.responseXML.documentElement.getAttribute("answer");
		alert(answer); 
}

 

 

 

Server side code: Script include

var HelloWorld = Class.create();
HelloWorld.prototype = Object.extendsObject(AbstractAjaxProcessor, {
	helloWorld:function() { 
		
		var instanceURL = gs.getProperty('glide.servlet.uri');


		return instanceURL; 
	} ,

	type: 'HelloWorld'
});

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

Pradeep Thipani
Mega Sage

Hi @shiz ,

 

Please follow the below steps to open custom view when you click on new button:

 

1. Go List controls.

2. Click on the "New" button to edit its properties.

3. check client checkbox

4. paste following in onClick

      getUiPage()

 

5. in script paste following code

function getUiPage(){

  window.location = "$your_custom_view.do"   ; //replace it with new UI Page

}

 

Modify according to your requirement as per view.

 

Referemce: https://www.servicenow.com/community/developer-forum/custom-view-to-open-from-list-control-button/m-...

 

Thanks,

Pradeep

"If this response was useful, please select 'Accept as Solution' and mark it as 'Helpful.' This helps me provide better answers and assists the community ".

Regards,
Pradeep

shiz
Tera Contributor

I'm really sorry, but I couldn't find a specific screenshot of the "Go List controls." you mentioned? Thank you very much.

shiz
Tera Contributor

Can you specifically teach me how to do it? If there are screenshots, that would be great. Thank you very much!