Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

HTML Link in the filed

sushma9
Tera Contributor

Hi All,

I am able to get the sys id of the attachments  associated  with the  KB Article and i am populating the sys id of the article in the HTML filed but i want the link  to be populated   . Can you please Provide me the HTML script to populate that  sys id of the article as URL in the filed .In the sys id filed i need a  url link like "Click here to download " insted of sys id. .

sushma9_0-1701962747978.png

 

 

1 ACCEPTED SOLUTION

Ethan Davies
Mega Sage
Mega Sage

You will need to create some sort of functionality to generate an appropriate URL for the sys_ids you are returning. You could do something like this.

var attachmentID = 'SOME_SYS_ID'
var attachmentURL = gs.getProperty('glide.servlet.uri')+'nav_to.do?uri=sys_attachment.do?sys_id='+attachmentID;
var urlDisplayValue = 'Click here to download attachment...';

// This is the code we need to insert into the HTML field.
var clickableURL = '<a href="'+attachmentURL+'">'+ urlDisplayValue +'</a>'

 Once you have the 'clickableURL' value, you then need to insert that value into your HTML field.

View solution in original post

1 REPLY 1

Ethan Davies
Mega Sage
Mega Sage

You will need to create some sort of functionality to generate an appropriate URL for the sys_ids you are returning. You could do something like this.

var attachmentID = 'SOME_SYS_ID'
var attachmentURL = gs.getProperty('glide.servlet.uri')+'nav_to.do?uri=sys_attachment.do?sys_id='+attachmentID;
var urlDisplayValue = 'Click here to download attachment...';

// This is the code we need to insert into the HTML field.
var clickableURL = '<a href="'+attachmentURL+'">'+ urlDisplayValue +'</a>'

 Once you have the 'clickableURL' value, you then need to insert that value into your HTML field.