Passing parent URL parameters from Configurable workspace to service portal

mangeshgangarde
Tera Contributor

Hello,

I have a requirement to replicate a native UI functionality into configurable workspace. 

Once you click on the save button on the case record, it should redirect to open the service portal in a new tab and parent parameters(table name and sys_id of the parent record should be passed to the url).

mangeshgangarde_0-1677224986644.png

mangeshgangarde_1-1677225190555.png

I am able to achieve the redirection using a workspace client script on the 'Save' UI action.

 

var result = g_form.submit('sysverb_ws_save');
	if (!result) {
		//failed form submission
		return;
	}
	result.then(function() {
			var params = {};
			params.parent_table = "my_table_name";
			params.parent_sys_id = g_form.getUniqueValue();
			g_service_catalog.openCatalogItem('sc_cat_item','-1', params);		
	});
}

 

As you can see, I am passing the parameters here. But, when I try to retrieve these parameters in one of the widgets using  $sp.getParameter("parent_sys_id") on the server side, I get null value.
I tried to print the url using window.location.url and I get "https://instancename.service-now.com/swp"
which means the parameters are not getting passed to the url from UI action. 

Can anyone please help, where I am making a mistake? or any other way to achieve this in configurable workspace?
P.S. Same script works for the Agent workspace.

 

5 REPLIES 5

insyafie_unit4
Tera Contributor

Hi @Wybren1 ,

Thank you so much for the useful Catalog Client Script! I managed to get the parameter from URL in CSM Workspace successfully and the value auto population is working as expected. Again, thank you!!