I am not even able to do a query like this,
Database.query('SELECT Id FROM RemoteProxy WHERE SiteName='TestSettings' LIMIT 1');

I want to delete a RemoteProxy record from apex code, someone please do help.

I tried deleting it through tooling API, but it seems tooling API doesn't support delete query for RemoteProxy.

  • You would need to do an actual metadata deployment, as far as I'm aware. This is possible, but non-trivial, in Apex. Why are you trying to do this? What's the end goal?
    – sfdcfox
    Jun 28, 2020 at 17:04
  • I am able to create RemoteProxy via Tooling API. (I am using jsforce package for nodejs) But, when I try to delete it, it says delete is not supported for RemoteProxy. So, I am trying to achieve it by running anonymous ApexCode. But, there comes this issue where I am not even able to do a query over RemoteProxy. @sfdcfox The main goal is, when the user disconnects from my app, I should delete whatever data traces related to my app that remain in salesforce. Jun 30, 2020 at 6:48

1 Answer 1


You need an actual deployment. This can be either a metadata deployment, or by uninstalling the package that contains the Remote Site Setting. The object in question is the RemoteSiteSetting. You should be able to do this with the apex-mdapi wrapper.

  • What do you mean by an actual deployment? I am a beginner in the world of Salesforce. I want do this as simple as possible. Thanks a lot for your timely help. Jun 30, 2020 at 10:13
  • @PreveenRaj You have to call the Metadata API somehow. From Apex, the fflib mdapi wrapper is your best bet. Otherwise, having the connection in an installed package means you just have to call an uninstall package call when you're done; less cleanup for you to worry about.
    – sfdcfox
    Jun 30, 2020 at 14:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .