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

calebc
Giga Contributor

Try the following code. The non-breaking space was missing and there was some extra syntax at the end.

 

[code]<a href='"+current.u_wizard_link+"' target='_blank' class='btn btn-default  icon-open-document-new-tab'>&nbsp;Deer Form Link</a>[/code]

Result:

find_real_file.png

Thank You  This pointed me in the right direction.  This is what ended up working.  

 

(function calculatedFieldValue(current) {

return "<a href='"+current.u_wizard_link+"' target='_blank' class='btn btn-default  icon-open-document-new-tab'>&nbsp;"+'Deer Form Link'+"</a>";


})(current);

Hi @Chuck Tomasi ,

 

Below is the SS of action and the script used from which I am getting the Alert URL on the Chnage Req form.

 

Script:

RakshandaKunte_0-1685100954320.png

 

 

Change Req Form showing the URL of Alert Record:-

RakshandaKunte_1-1685100954307.png

 

 

 

Here, in place of URL, I want to display Alert Number, and it should function same as URL, i.e. clickable (Like Sometimes we give hyperlink).

 

 

 

Thanks..!!

Desmo
Mega Guru

Great post. I'm struggling to get the following link to work.

I have a string field with a calculated value that opens form to create a new record. The field is added to a list view. It works per design.

return "[code]<a href='incident.do' target='_blank' class='btn btn-default icon-edit'>Click here</a>[/code]"; 

The next step is to include a script that adds the parent sys_id into the parent field. I was thinking it would be this. However, any iteration produces a non-working link, in which I think it's mainly due to the part where it tries to get the sys_id to populate the parent field. Below are examples.

return "[code]<a href='incident.do?sys_id=-1&sysparm_query=parent=^current.sys_id)' target='_blank' class='btn btn-default icon-edit'>Click here</a>[/code]"; 

return "[code]<a href='incident.do?sys_id=-1&sysparm_query=parent=current.sys_id' target='_blank' class='btn btn-default icon-edit'>Click here</a>[/code]";

 

Thank you,

Desmo

VigneshMC
Mega Sage

This works fine in native UI , has anyone tried with in Service Portal , with OOB list widget even OOB URL field is not clickable . Any thoughts?