Show Link/URL in List with Display Value

MarcB1
Tera Guru

Hi

We like to insert a link to a Catalog Item in a "regular" list.

I know there is a field type "URL" and another type "HTML".

Unfortunately, the HTML field type only works fine on the form itself and the URL field type does not allow setting an display value.

How is it possible?

List.png

Form.png

btw: the values are calculated:

calc.png

1 ACCEPTED SOLUTION

None that I know of at this point for the list view.



I love the idea and invite you to open an enhancement request! Our product managers DO listen.


Enhancement requests: Tell us how you would improve the ServiceNow product


View solution in original post

39 REPLIES 39

ralvarez
Tera Guru

Hi Marc,

I managed to achieve the same thing by using a simple string field. Just a few considerations:
- The field should be long enough to contain our URLs (1000 characters is the length I chose)
- We need the parameter "no_truncate=true".
- Place your URL, or any other HTML code, between [code][/code] tags.

For instance, in my case I was looking to have a list of applications where their class name is a link to their Dependency views. So the value of my field is calculated as follows:

(function calculatedFieldValue(current) {
	return "[code]<a href='/$ngbsm.do?id="+current.sys_id+"' target='_blank' class='btn btn-default icon-tree'>&nbsp;"+current.getClassDisplayValue()+"</a>[/code]"; 
})(current);

 

Result:

find_real_file.png

Note: If it happens that you need "&" characters in your URL, use the encoded version, otherwise the link won't be rendered.

Are you creating a business rule? can you explain how you got this to work.

Sorry for my late reply manibaig, I imagine you already figured it out, but just in case, I'm not using a business rule here, but a calculated field value.

Hi Ralvarez,

Need a little more direction please:-)?.. Your solution will solve our issue, but we cannot get it to work.  It is not rendering as expected.  How do you determine what the name will be and how is it clickable? 

Result

find_real_file.png

 

 

Field Set-up

 

find_real_file.png

 

 

Andrew, you are almost there, you just need to use HTML syntax within the [CODE] tags, like I did in my example.

[code]<a href="{your url}">{Text to show}</a>[/code]

Oh and pay attention to the note about using "&" in my previous post