Adding external link to Module

dhananjay_m
Kilo Contributor

I have case where in the Module on left hand navigation needs to be pointing to external links(out of Service now) which will be dynamic based on different environments such as dev, uat ,prod. So in case of dev the module link should point to http://www.xyz.com in case of uat it should point to http://www.abc.com and similarly for prod. I tried with URL (from arguments) but this typically doesn't solve my problem as I cannot associate a javascript function call in it. Script (from argument) also doesn't work in this case as it renders a script as a script call instead of evaluating the function. Ideal scenario would be if I can associate a function within the arguments where I can decide which link to render based on current service now instance.

Any one has come across such scenario?

Thanks,
Dhananjay

10 REPLIES 10

gaidem
ServiceNow Employee
ServiceNow Employee

I have not come across this, but I'm also confused because this shouldn't be difficult.

First off, why does it need to be dynamic? Why can't you set it accordingly in the environments?

If it does need to be dynamic, you could do several things...
Create a function
Create a translation table associating links to the instance
Create properties

You should certainly be able to call a function and return a url as a string.


gaidem
ServiceNow Employee
ServiceNow Employee

I posted "You should certainly be able to call a function and return a url as a string."

I take this back, it doesn't seem easy to do.

Is there a huge business driver to not manually update each instance?

If you want the URL contained in the frame you can simple create a new module using the URL (from Arguments:) option specifying the URL. If you want it in a new window you can use the same URL (from Arguments:) type with something like:
javascript:window.open("http://www.google.com/");


User12975
Tera Contributor

this works many thanks 🙂

 

ctu1
Giga Expert

Hi, have you thought about not doing this with the instance but rather have someting fix which the receiving webserver could redirect according to where the request came from? Might be easy to do...