URL fields in Service Portal

Alexey8
Kilo Contributor

Hi all, could please someone explain about URL fields in service portal? 

I have a table where one of fields is URL type. By clicking on it in the instance, it opens external site in new tab. 

I want the same functionality for Service Portal page. 

For now I created a page with OOB a widget called 'Data Table from Instance Definition'. It shows needed table, but all fields are just like string fields, so URL field doesn't work as expected. 

Is the only way to use URL fields from table is to create totally new widget? 

 

Thanks in advance for any help! 

1 ACCEPTED SOLUTION

nathanfirth
Tera Guru

Hi, although the OOB Data Table won't make the URL clickable, you can achieve this by wrapping the Data Table widget in your own widget and listening for the "data_table.click" event. You will likely need to pass in some Options to the Data Table so that it knows what to render along with some conditional logic for tables where there is no URL field.

Example:

$rootScope.$on('data_table.click', function(event, obj) {
	$window.location.href = obj.url
})

Note: "Data Table from Instance" and "Data Table from URL Definition" both just embed the "Data Table" widget and extend the logic, so you can use those as a reference.

View solution in original post

3 REPLIES 3

nathanfirth
Tera Guru

Hi, although the OOB Data Table won't make the URL clickable, you can achieve this by wrapping the Data Table widget in your own widget and listening for the "data_table.click" event. You will likely need to pass in some Options to the Data Table so that it knows what to render along with some conditional logic for tables where there is no URL field.

Example:

$rootScope.$on('data_table.click', function(event, obj) {
	$window.location.href = obj.url
})

Note: "Data Table from Instance" and "Data Table from URL Definition" both just embed the "Data Table" widget and extend the logic, so you can use those as a reference.

Hi Nathan
Thank you for your answer, although I have already applied a similar solution. Sorry I forgot to share it, my fault :). But surely this answer will be very useful for many users with a lack of knowledge of Angular.

But besides, since I think you have some influence on SNOW), I want to ask you to add this function to OOB widgets.

And even more, I think SNOW really needs to think how become easier to develop and manage, more flexible, you need more “drag & drop” features during the development process, making less and less efforts for fixing OOB functionality.
Such things will make SNOW - as a product, much more user friendly, because it allows to choose SNOW for a business that does not have experienced IT engineers, but is interested in SNOW concepts. This is my opinion 🙂 it is nowdays trend - 'make thing easy as possible and earn on widnes of your clients quantity not on difficulty and highpriced studdings'. And I'm sure SNOW is exactly such a product which can make it! I wish you good luck in developing SNOW better and better! 😉

Suz Roque
Tera Expert

HI @nathanfirth , i know this is an old post but i am having the same issue. Can you explain to me step by step your recommended solution please? I am just starting in Portal..  we added the OOB widget "Data Table from URL Definition"  to display records from table, the problem is the Reference and URL fields are not behaving as link in Service Portal.  Thank you!

I have posted this in community https://www.servicenow.com/community/sysadmin-forum/how-to-enable-link-in-service-portal-quot-data-t...