Make a URL field to open file in local computer folder

manoj12398
Giga Contributor

How to make a field to open a file in local folder location. Need to be a field which containing a URL to open the file. Please help!!!!

4 REPLIES 4

HugoFirst
Kilo Sage

Hello Manoj,



If I understand your question a URL meeting this pattern should work:



file://<path to file>



For example, file://C:\Users\userid\Desktop\ServiceNow\stages_01.gif     will open a file named stages_01.gif in the ServiceNow folder on my Desktop.


Thanks Steve for the reply.   Actually the need is to create a field (type= URL)   and insert a link to open a file in local folder. Please find below image.



Something like this should work or any other way to achieve this is also useful for me. Kindly advice.


URL test.PNG


Suresh1
Tera Guru

Hi Manoj,



I believe you are willing to open the records in the computer and want to attach. If my belief is correct, Here you can a Macro to open files in computer folder and can attach these files if you need.


Here is the step-by-step procedure:



1. Create UI Macro
1a. In the "Type Filter Text" search for UI Macro
1b. Create New:
1c. Paste the following code:




  1. <?xml version="1.0" encoding="utf-8" ?>  
  2. <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">  
  3. <b>Use the paperclip</b>  
  4. <a onclick="saveCatAttachment(gel('sysparm_item_guid').value, 'sc_cart_item')">  
  5. <img title="Attachments..." height="16" src="images/icons/attachment.gifx" border="0" width="16"/></a>  
  6. <b>to attach items to this request.</b>  
  7. </j:jelly>  


2. Add a Variable to your Catalog Item.


3. Type-- UI Macro


4. Choose your newly created macro in step 1.


5. It should show up on your form (see attachment) it is clickable and functions just as the OOB paperclip icon on the top right of forms.


6. If you want change two attributes in the code above


6a. Change the icon by uploading an icon or choosing one from the image browser (src="images/icons/attachment.gifx" or src="images/pdf.gifx")


6b. Change the size of the icon (height="16" or height="25")



Try out your UI macro.


Thanks Suresh for the reply.



I have tried creating a UI macro and UI formatter, which in turn creates a hyperlink on a table form but its not opening the file location in the local folder of my (file:\\C\folder\document.docx).




Please find below image. Any technique is fine for me like using UI macro or any but i need help, if we click on the link it should to go to local folder file location. Thanks for your help.


URL test.PNG