Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

How to Create A Hyperlink in Scripted REST API

Sandeep Kumar6
Giga Guru

Hi There,

I was trying to send a Link from Scripted REST API to Ok Google app but instead of sending as a link its sending in text

Can someone help me in this,

 

REgards

Sandeep

14 REPLIES 14

Hi Sandeep,

Following is an example for incident table

var rBody = {};

rBody.url = 'http://' + gs.getProperty('instance_name') + '.service-now.com/incident.do?sys_id=' + sysId;

response.setBody(rBody);

Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur 

I thing i confused you

 

See the below code:

if(g_parking.next())
{
var message1=" Click on link to goto that Location ";


var Url = "http://www.google.com/maps/place/"+g_parking.u_lattitude+","+g_parking.u_lognitude;


message = message1 + knowledgeUrl ;
}
else message= "There is No Parking available";
}

 

 

Now here you see URL that i want to send Out of ServiceNow in Clickable form.

I need to send message as a whole.

 

Expected Result:

Click on link to go to that Location HYPERLINK

 

Hi Sandeep,

Where are you displaying that message?

Click on link to go to that Location HYPERLINK

Regards

Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

I want to send sending message and the link  in clickable format.

 

Example :

<Text :Click on link to go to that Location> <Clickable link: HYPERLINK>

 

Thanks

Sandeep

Hi Sandeep,

Where have you written this code?

Also can you explain the scenario for this.

Till now I am assuming the script to be in scripted rest api and the link/url should be sent over as API response.

Regards

Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader