Adding customize error message to image link if the associated link has no image or document

511
2
09-13-2021 08:44 AM
SunitaKhanal
New Contributor III

Hi!

I have a folder in the server machine that has all the additional pdf documents associated with a few assets. I have no problem displaying the document either as a link or as an image when this document exists in the folder. But the problem is not all assets have additional documents and when I click the link of those assets, I get a server error 404 message. Is there any way I can customize the message showing 'No Additional document available for this asset' instead of the default message? If yes, where should I add that?

SunitaKhanal_3-1631547354053.png

SunitaKhanal_1-1631546951039.png

Thanks in advance for your time and suggestion. 

Sunita

 

 

0 Kudos
2 Replies
mdonnelly
Esri Contributor

Hi Sunita,

I'm assuming that you have a field that contains urls to your documents or images.

One possibility would be to work out which records do not have documents and images and then create a web page with your custom message that can be displayed for them instead.

It is not easy to do this 'on the fly' as the detecting a 404 is an asynchronous activity, which is hard to detect with things like Arcade expressions.

So, this is something you will likely have to pre-calculate. You could use the method I suggested earlier and create a custom web page for 'empty' document/image records. You would then place that custom web  page in the folder with the appropriate id in its name so that the link will pick it up (hence no 404). 

Alternatively, there may be a way to tell which records do not have associated documents/images from values in other attributes? If so, you could potentially use some Arcade to call your custom web page instead of a dead link.

Regards,
Mark
0 Kudos
SunitaKhanal
New Contributor III

Hello Mark, 

Thank you so much for taking the time to respond to my question. I actually do not have a field in my data to store the URL and instead, images/documents are uploaded to a folder on our server with and the link is then inserted into the pop-up. It is more like one-to-one relation and all assets that don't find an image/document throughs 404 error. I like the idea of creating a custom message for all assets that do not have images or documents. I am quite not sure how to do it, but I would like to explore that. I will post the solution if I figure out how. 

Thanks again, 

Sunita

 

  

0 Kudos