URL type field containing a network path

hartr
Giga Contributor

I have a requirement to have a field on a form similar to a URL field but containing a link to a shared local or network folder. I'd like to be able to have a browse function to select the folder to be entered into the field, and a "goto" function to open the folder in windows explorer.
Has anyone had to create anything similar ? Any ideas welcome !

6 REPLIES 6

shill
Mega Sage

hartr, did you manage to solve this? I have the same requirement.


john_roberts
Mega Guru

Not sure how you would build a browse feature but if you add a URL value like file://host/path it should trigger the client to access the file system.


hartr
Giga Contributor

I never got this to work I'm afraid - I think it has to do with browsers not having direct access to a local / network file system for security reasons. In the end the user had to copy / paste the url into file manager - not ideal..


Michael Domke
Tera Guru

I have a similar project underway but it only involves opening a file (e.g. a PDF) and not any folder browsing capabilities. In my testing I'm finding this is probably not going to work from ServiceNow. Well, I shouldn't say ServiceNow specifically, but rather from any web page involving a cross domain access to the shared file.

Here's what I found:
First, forget any non-IE browser. I just couldn't get the file:// protocol to work in Firefox. You can, however, paste the href directly into the address bar in Firefox and it will display the file, but of course we want it to be clickable from the web page, and that just doesn't work. There's certainly info on the web claiming it can work by altering config options in Firefox but all those options failed for me. It does, however, work just fine in IE.

Second, and most important, I could not get this to work, regardless of browser, when the web page that contains the link is hosted on a different domain than where the file is shared. So, including a link in a ServiceNow page and referencing a file in my companies domain failed. If I used an identical link on a web page that is hosted "inside" my companies network (e.g. localhost), the link opened the file just fine - again, only in IE, though. At first I suspected this might be a ServiceNow restriction but I tested this by moving my web page to a hosting environment outside my companies network and it failed from there just at it did when hosted in ServiceNow. So, the only conclusion I can come up with right now is that cross domain access to shared files using the file:// protocol is not going to work.

Alternative solutions:
I did find alternative solutions but these solutions violate the requirement that the file comes from a shared drive.

These solutions include storing the file in ServiceNow. Using the Upload File option in the System Definitions application moves the file to ServiceNow which then provides a link to reference the file. This works great in any browser but again, my file is now at ServiceNow.

The other solution is to make the shared resource folder part of the companies web presence. That way I can use the http:// protocol to get at the file. This would work in all browsers as well but the drawback here is that I would need to get a lot more groups involved in my project than I anticipated. But that's another story.

Michael