function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mar1BMar1B 

how to retrieve remote site details through Apex

Hello,

 

I would like to know if there is a programatic way (through Apex) to fetch the metadata type: RemoteSiteSettings

I just want to display the list of allowed remote sites urls on a visualforce page.

 

I tried to query  labels from Schema.getGlobalDescribe, but I can't find any reference to remote settings.

 

thank you in advance.

 

Greetz

Mar1B

 


SurekaSureka

Hi,

 

Remote Site Settings are part of Metadata API. So you need to access it through Metadata API. Workaround is to store the Remote Site settings as Custom Settings and use it in the VF page.

 

Thanks

 

Mar1BMar1B

Thank you.

 

The little issue with using Custom Settings is that you can't be sure of getting always the correct data. 

For example, each time a new remote site is added/deleted the user must update manually the list of custom settings.

 

Have a nice day.