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.

How to get the hyperlink in Onchange catalog client script

Suvedha Vignesh
Tera Contributor

Hi All,

 

I need to get the hyperlink in onchange of catalog client script. I am getting this correctly. But the problem is click here is second link. can we get it in first line.

SuvedhaVignesh_0-1718942863506.png

Script:

 

var link = '<p><a class="web" target="_blank" href="' + "/sp?id=sc_cat_item&sys_id=" + id + "&sysparm_category=" +cat +'">' + "Click Here" + '</a></p>';
g_form.addErrorMessage(rel+" "+'CIs you are trying to remove has one last relationship with Application Service or Dynamic group which can make the CI orphan.'+""+"Please raise the general Request."+ link);
 
Thanks,
Suvedha.
1 REPLY 1

Zach Koch
Giga Sage

I would get rid of your <p> tags. They aren't required and they are pushing your link to a new line.

It would look like this

var link = '<a class="web" target="_blank" href="' + "/sp?id=sc_cat_item&sys_id=" + id + "&sysparm_category=" +cat +'">' + "Click Here" + '</a>';

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!