AnsweredAssumed Answered

Disable/hide a url on a web map popup if nothing is found on the host web server (404 error)?

Question asked by andrescastillo08 Champion on Nov 7, 2018
Latest reply on Jul 16, 2019 by andrescastillo08
We need a way to hide a pop up hyperlink if no file is found in the IIS virtual directory to be served out by the web server.
I don't want the user to click on hundreds of features that open a 404 error page until they finally open a feature that actually opens a resource.
Here is some context:
We have a user defined unique identifier string field.
Every record has an ID.
In a web server, we are storing and serving out videos/pdfs with the ID as the file name.
For example,
In the popup for a feature, the ID field value is ID123.
In AGOL, configuring a custom attribute display, I create a link, and set the url to:
Set the link text to:
Click Here for Video
I do a similar configuration for the pdf files.
In the web server, we do not have .mp4s and pdf's for every one of our ID's,
such as ID123.mp4 and/or ID123.pdf
So, when the user clicks the 'Click Here for Video/PDF' link, they are taken to a 404 error page because the file is not available in the web server.
I started trying to do this with Arcade attribute expressions, because Arcade can show or hide an attribute field, based on whether or not there is an attribute value in the specific feature record.
My ID's will always have attribute values, so Arcade would always show the ID field.
My intent is not to hide the ID field anyways.
The issue with using Arcade for my scenario is that I do not have a Hyperlink field in my table schema for Arcade to hide.
Furthermore, Arcade does not seem to be capable of getting header response info from the web server.

The issue I have with adding the new field to indicate whether or not the feature has files is that the directory is consistently changing (is dynamic).

People may upload new files into the directory on a daily basis.

This means that the values in my field would be outdated.

For example, ID234 might not have a file corresponding to it today, but might have a ID234.pdf in the web server virtual directory tomorrow.




This resource might be a good starting point: