Select to view content in your preferred language

map viewer - need a hyperlink in pop-up window to laserfiche documents based on data stored in column in feature class

507
5
Jump to solution
11-07-2024 09:56 AM
L77
by
Frequent Contributor

I created a feature class in Arc Pro and published it in AGOL for our surveyors to show the locations of their monuments and have the points link to the recorded survey document in our Laserfiche database online.

Here is what the table looks like in Arc Pro, note that in Arc Pro it is a hyperlink and if I click Ctrl and click on the link it will open in my web browser.

L77_0-1730999012526.png

When I published the feature class online and opened it in Map Viewer it no longer shows up as a hyperlink:

L77_1-1731000290341.png

 

If I copy and paste the link into my browser it will take me to the correct document.

Note that in the link below the only thing that will change will be the Rec Doc AFN number and that number is stored in my attribute table:

https://www.cowlitzinfo.net/WLAudPublicWorks/Search.aspx?dbid=0&repo=CCIMAGES&searchcommand={[AUD - Recorded Documents]:[Rec Doc AFN]="3753011", [Rec Doc Document Type]="SURVEY"}

In this example when I paste this link in my browser it finds the correct document but the resulting link changes to a random id number that is assigned to the document by laserfiche:

https://www.cowlitzinfo.net/WLAudPublicWorks/DocView.aspx?id=31904090&dbid=0&repo=CCIMAGES&searchid=...

The metadata for the survey shows the search criteria that is used, which is how I was able to create the link that I stored in my attribute table.

L77_2-1731000827601.png

I used Chat GPT to try to get the hyperlink to work in Arcade in Map Viewer and have been working on it for a day and a half but no matter what I try the hyperlink does not work. 

I would appreciate if someone would  please take a look at it.

Attempt 1:

First I tried clicking Add content Arcade, but no matter what I added it didn't show up in the pop up window:

L77_3-1731001025419.png

 

Next I tried clicking Options, Attribute Expressions, Add Expression and then I was able to see the link I was working on:

L77_4-1731001095008.png

When I click Run with the following code, if I copy and paste the output into my web browser it goes to the correct document.

L77_5-1731001281672.png

var afn = $feature.Rec_Doc_AFN
var url = "https://www.cowlitzinfo.net/WLAudPublicWorks/Search.aspx?dbid=0&repo=CCIMAGES&searchcommand={[AUD - Recorded Documents]:[Rec Doc AFN]=\""+ afn +"\", [Rec Doc Document Type]=\"SURVEY\"}"
 
return url

 

Output Link:

text: 'https://www.cowlitzinfo.net/WLAudPublicWorks/Search.aspx?dbid=0&repo=CCIMAGES&searchcommand={[AUD - Recorded Documents]:[Rec Doc AFN]="3753011", [Rec Doc Document Type]="SURVEY"}'

 

But when I click Done, and click on the link in the pop-up window it goes to this link instead which says " No results have been returned yet".

https://www.cowlitzinfo.net/WLAudPublicWorks/Search.aspx?dbid=0&repo=CCIMAGES&searchcommand=

 (Note that I added a text box with it linked to the expression to get it to show up in the pop-up window)

L77_7-1731001867443.png

L77_8-1731001941643.png

 

 

Attempt 2:

Next I tried creating a text box and using it to turn the column in my attribute table that contains the full document link into a hyperlink. But that didn't work either.

L77_6-1731001703129.png

 

0 Kudos
1 Solution

Accepted Solutions
L77
by
Frequent Contributor

After working to resolve my hyperlink issues since November I finally received a no reply back email from ESRI support regarding this issue: It took them months to tell me that using special characters in hyperlinks is now considered a security issue, and so it is "by design, and not actually a bug. UGH!

Why did that take them months to communicate this? Shouldn't this be in some sort of documentation.

Here is the email in case you run across the same issue:

Bug fixes are addressed in upcoming releases or general patches, or they may be addressed as ad-hoc fixes. Enhancement requests are implemented in upcoming releases.

Updates have been made to the following defect which you are associated with:
BUG-000173571 - The URL added to a text in the pop-up is truncated when there is a curly bracket '{}' after the equal sign in the URL.

Status: As Designed (Learn More)
Additional Information:  Curly braces are designated as unsafe characters to include within URLs and must be encoded to be used safely. Otherwise, the values will be sanitized from the URL. Information on unsafe characters in URLs: https://support.exactonline.com/community/s/knowledge-base#All-All-DNO-Content-urlcharacters

Please note that links containing curly braces can be successfully launched from other places, e.g. the attribute table. This is a bug and will be fixed in the next updates of ArcGIS Online and Enterprise.

Alternate Solution:  

There are several safe options for generating a URL for pop-ups that include a specific value or have a value change dynamically. 1. Use the link tool in the text editor to create the link. The link can be static or dynamic, e.g. baseURL + {field_name}. The curly braces in this case are not part of the URL, they're ArcGIS's way of referencing a field or attribute expression so that values from your dataset can be dynamically inserted. 2. Use Arcade to generate the URL. Either using attribute expressions or Arcade elements. For example, return 'baseURL' + $feature.ID OR leverage the text functions Right() and EncodeURL() to extract and encode the value enclosed in curly braces and then add that to the base URL.


Thank You,

Esri Inc.
THE SCIENCE OF WHERE™

View solution in original post

0 Kudos
5 Replies
L77
by
Frequent Contributor

I still haven't made any progress on getting my hyperlink to work, if anyone has any advice I would appreciate it.

 

0 Kudos
gis_KIWI4
Frequent Contributor

@L77 it's the "{" that are the problem in URL that are the problem. You are doing everything right, it's just the way it parses that expression that's causing the issue. 

As a test I used the URL - "https://www.google.com/" it works fine. 
In fact, it even recognizes the attribute value as a URL in the pop-up without any

gis_KIWI4_0-1736996537233.png


What I would suggest is that you encode the special characters. 

// Arcade Expression

// 1. Original URL with special characters
var fullUrl = "https://www.cowlitzinfo.net/WLAudPublicWorks/Search.aspx?dbid=0&repo=CCIMAGES&searchcommand={[AUD - Recorded Documents]:[Rec Doc AFN]=3102328}";

// 2. Manually replace special characters with percent-encoded values
var encodedUrl = Replace(fullUrl, " ", "%20");
encodedUrl = Replace(encodedUrl, "{", "%7B");
encodedUrl = Replace(encodedUrl, "}", "%7D");
encodedUrl = Replace(encodedUrl, "[", "%5B");
encodedUrl = Replace(encodedUrl, "]", "%5D");
encodedUrl = Replace(encodedUrl, "=", "%3D");

// 3. Return the fully encoded URL
return encodedUrl;


fullURL can be set to whatever attribute has the URL in it. 
I can't test it but it looks like it might work. 




gis_KIWI4_1-1736998273112.png

 

0 Kudos
L77
by
Frequent Contributor

I tried that but it wasn't working. I spent a few hours trying to use the query you gave me to get it to work using chat gpt too, but that also didn't work.

The worst part is this worked well in web app viewer classic and in web app builder. I don't know what I am doing wrong but I have tried dozens of scripts. Some will direct to the laserfiche site but none go to the specific document.

0 Kudos
L77
by
Frequent Contributor

I met with ESRI tech support and they filed this as a bug.

https://my.esri.com/#/support/bugs/bugs?bugNumber=BUG-000173571

"The URL added to a text in the pop-up is truncated when there is a curly bracket '{}' after the equal sign in the URL."

L77
by
Frequent Contributor

After working to resolve my hyperlink issues since November I finally received a no reply back email from ESRI support regarding this issue: It took them months to tell me that using special characters in hyperlinks is now considered a security issue, and so it is "by design, and not actually a bug. UGH!

Why did that take them months to communicate this? Shouldn't this be in some sort of documentation.

Here is the email in case you run across the same issue:

Bug fixes are addressed in upcoming releases or general patches, or they may be addressed as ad-hoc fixes. Enhancement requests are implemented in upcoming releases.

Updates have been made to the following defect which you are associated with:
BUG-000173571 - The URL added to a text in the pop-up is truncated when there is a curly bracket '{}' after the equal sign in the URL.

Status: As Designed (Learn More)
Additional Information:  Curly braces are designated as unsafe characters to include within URLs and must be encoded to be used safely. Otherwise, the values will be sanitized from the URL. Information on unsafe characters in URLs: https://support.exactonline.com/community/s/knowledge-base#All-All-DNO-Content-urlcharacters

Please note that links containing curly braces can be successfully launched from other places, e.g. the attribute table. This is a bug and will be fixed in the next updates of ArcGIS Online and Enterprise.

Alternate Solution:  

There are several safe options for generating a URL for pop-ups that include a specific value or have a value change dynamically. 1. Use the link tool in the text editor to create the link. The link can be static or dynamic, e.g. baseURL + {field_name}. The curly braces in this case are not part of the URL, they're ArcGIS's way of referencing a field or attribute expression so that values from your dataset can be dynamically inserted. 2. Use Arcade to generate the URL. Either using attribute expressions or Arcade elements. For example, return 'baseURL' + $feature.ID OR leverage the text functions Right() and EncodeURL() to extract and encode the value enclosed in curly braces and then add that to the base URL.


Thank You,

Esri Inc.
THE SCIENCE OF WHERE™

0 Kudos