0

I have written an apex class which makes a callout to an external API, and the endpoints need to be different for the sandbox and production.

I need functionality like environmental variables so the code can remain unchanged and the variables can be different in production.

I came across custom settings which looks fine for this purpose but after I create the custom setting, create my desired fields, when I put in organization default values it hangs and times out after a few minutes saying "Time limit exceeded: Your request exceeded the time limit for processing.".

I've tried waiting an hour or so and seeing if it resolves itself but I always get this result, and no values are inserted.

  • Why is this happening?

  • and are there any alternatives to custom settings for this purpose?

3

You should be able to achieve this through the use of named credentials:

https://help.salesforce.com/articleView?id=named_credentials_about.htm&type=5

...A named credential specifies the URL of a callout endpoint and its required authentication parameters in one definition. To simplify the setup of authenticated callouts, specify a named credential as the callout endpoint...

1
  • perfect, exactly what I was looking for
    – rosghub
    Jan 28 '20 at 21:12

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.