11

I have created a managed package that uses tooling API for updating class, trigger etc. Everything runs fine with all sorts of testing. I have created this package in my Developer org. I had to set the endpoint for Tooling API.

Added the remote Site setting to package too. It failed to work in one of our sandbox since the endpoint was different there (Which i realized later). After a long research I got to know may be with Metadata API I will create Remote Site URL with Apex. But again that requires endpoint.

Is there any way I can over come this issue ?

  • What is the actual issue you are having, that you need to change the API endpoint between sandbox and production? If so, that is unfortunately going to be the case. – Michael Welburn Jan 24 '14 at 5:15
  • I have created a managed package which uses Tooling API . It requires endpoint to be set in RemoteSite settings. So it was different for different instances which needed to happen dynamicaly after installing package. – Soberano Feb 4 '14 at 8:58
9

The "correct answer" is that administrators are expected to configure any endpoints that they need to use manually in a situation like this. This is a one time process, takes only a minute to complete, and is often used in packages that access salesforce.com servers. This is the best solution, because with the addition of "my domain" settings, there are nearly unlimited possible salesforce.com URLs, and you can't use wild cards.

That said, if you wanted to automate it, you could:

  • Write a Flash script that performs the call, and embed it in a Visualforce page.
  • Write a Java applet that performs the call, and embed it in a Visualforce page.
  • Write a third-party server with known endpoint (embedded in the package), and callout to that known endpoint to perform the call.
  • Write some logic in JavaScript, and call that from a Visualforce page.
  • Write a Silverlight app that performs the call, and embed it in a Visualforce page.

As you can see, most solutions are probably over the top. Just have the administrator enable it once and forget about it.

In Apex Code, you can determine the correct endpoint by using Url.getSalesforceBaseUrl() to make the Apex Code part dynamic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.