How to work with an Interceptor in Agent WorkSpace

Diego Sanchez
Tera Contributor

Hello! I have implemented an Interceptor for when you are going to create a new incident onbehalf of the users, according to the type of case that is necessary to create the interceptor will direct the agent to a form that is related to a particular table.

find_real_file.png

However, I have not managed to see this reflected in the Agent Workspace, I mean when from the Agent Workspace you click on the New button, it sends directly to the sn_customerservice_case table without considering the type of case you want to create. 

I want to implement something similar to what happens when from Agent Workspace you try to create a new Change Request. Could anyone guide me on how to do it? I would be very grateful

find_real_file.png

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi,

Put the script inside "Workspace client script" on your UI Action. 

find_real_file.png

 

Script include:

 

var getUrlSio = Class.create();
getUrlSio.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {

	getURL: function(){
		var id = gs.getProperty("glide.servlet.uri");
		var url = id+'wizard_view.do?sys_target=&sysparm_wizardAction=sysverb_new&sysparm_parent=8db4a378c611227401b96457a060e0f4';
		return url;
	},

	type: 'getUrlSio'
});

 

UI Action Script:

 

function onClick(g_form) {
	alert('hey');
	var ga = new GlideAjax('sn_itsm_workspace.getUrlSio');
	ga.addParam('sysparm_name', 'getURL');
	ga.getXML(HelloWorldParse);

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

		var win = top.window.open(answer, '_blank');
		win.focus();
	}



}

 

 Refer this to learn more : https://community.servicenow.com/community?id=community_question&sys_id=1274159bdbbb68106064eeb5ca96192c

 

 

Please mark my answer as Correct & Helpful, if applicable.

Thanks

Sandeep

View solution in original post

3 REPLIES 3

Community Alums
Not applicable

Hi,

Put the script inside "Workspace client script" on your UI Action. 

find_real_file.png

 

Script include:

 

var getUrlSio = Class.create();
getUrlSio.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {

	getURL: function(){
		var id = gs.getProperty("glide.servlet.uri");
		var url = id+'wizard_view.do?sys_target=&sysparm_wizardAction=sysverb_new&sysparm_parent=8db4a378c611227401b96457a060e0f4';
		return url;
	},

	type: 'getUrlSio'
});

 

UI Action Script:

 

function onClick(g_form) {
	alert('hey');
	var ga = new GlideAjax('sn_itsm_workspace.getUrlSio');
	ga.addParam('sysparm_name', 'getURL');
	ga.getXML(HelloWorldParse);

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

		var win = top.window.open(answer, '_blank');
		win.focus();
	}



}

 

 Refer this to learn more : https://community.servicenow.com/community?id=community_question&sys_id=1274159bdbbb68106064eeb5ca96192c

 

 

Please mark my answer as Correct & Helpful, if applicable.

Thanks

Sandeep

Thanks, Sandeep. I did what you suggest and is working fine, however it creates a new tab in my browser, is possible to do this but keeping inside the Agent workspace window?  

Community Alums
Not applicable
This is the best way we can achieve. Same window not possible I think. Please mark the answer correct and helpful such that other experts can get help.