Our application makes outbound connections to different remote sites, and installs a short list of those sites as part of the Package Installation process.
One of our custom objects is a list of accounts to access on those servers (username, password, hostname). We just ran into a problem where someone mistyped a server hostname when adding an account.
I'd like to have a trigger before insert and modify that throws an error if the user tries to add an entry for a host that isn't in the Remote Site List. The error will state that they need to either change the hostname or add the site to the Remote Site List.
The trigger won't be able to make a callout, otherwise I could just try calling out and trapping the exception. Even if I can't walk the list of Remote Sites, it'd be great to call an API that tells me whether a given URL is in there or not. For example, if HttpRequest.setEndpoint()
threw an exception without having to call Http.send()
.