HOW TO

Create multiple field-based hyperlinks in a feature class using the Script option

Last Published: April 25, 2020

Summary

By default, setting hyperlinks in the Layer Properties dialog box in ArcMap only allows one field in a feature class to be designated as a hyperlink field. There are a few workarounds for opening hyperlinks from multiple fields, but sometimes these do not work when attempting to open the hyperlinks simultaneously. This is especially the case when attempting to open hyperlinks pointing to a folder path versus a document or a URL at one time. However, a short script can be used to open hyperlinks from multiple fields simultaneously when selecting a feature using the Hyperlink tool.

The instructions provided describe how to create multiple field-based hyperlinks in a feature class using the Script option in the Hyperlinks settings.

Procedure

To create multiple field-based hyperlinks to enable opening the hyperlinks simultaneously with one click using the Hyperlinks tool, follow the steps below:
  1. In ArcMap, add the feature class set up with hyperlink fields. Ensure the attribute table of the feature class contains fields with the desired hyperlink targets specified in each hyperlink field (folder or document path, or URL to a web page).

    The image below is an example of an attribute table of a feature class in which each feature is associated with two hyperlink fields; Hyperlink1 and Hyperlink2.
    An example of multiple field-based hyperlinks in an attribute table.
  2. Right-click the layer in the Table Of Contents > Properties.
  3. In the Layer Properties dialog box, click the Display tab.
  4. Under the Hyperlinks section, check the check box for Support Hyperlinks using field, select the Script option, and click Edit.  
    Selecting the Script option in the Layer Properties dialog box.
  5. In the HyperLink Script dialog box, change the Parser setting in the Script section to JScript, and type the following code into the box.
    function OpenLink ( [Hyperlink1], [Hyperlink2] )
    {
      var objShell = new ActiveXObject("Shell.Application");
      var path = [Hyperlink1];
      objShell.ShellExecute(path, "", "", "open", 1);
      var objShell = new ActiveXObject("Shell.Application");
      var path = [Hyperlink2];
      objShell.ShellExecute(path, "", "", "open", 1);
    }
    Note:
    The field names [Hyperlink1] and [Hyperlink2] must be replaced with the actual field names of the hyperlink fields from the feature class and each field name must be enclosed in square brackets [ ]. For example, if the hyperlink field names are 'Hyper_1' and 'Hyper_2', [Hyperlink1] and [Hyperlink2] from the script must be changed to [Hyper_1] and [Hyper_2]. 
    The following is an example of the HyperLink Script dialog box with the entered script code.  
    The HyperLink Script dialog box.
  6. Click the Verify button to ensure the hyperlinks open properly, and click OK for all dialog boxes to save the settings.
  7. Select the Hyperlink The Hyperlink tool icon. tool in the Tools toolbar, and click a feature in the map to open the multiple hyperlinks associated to the feature simultaneously.

Article ID:000017985

Software:
  • ArcMap

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options