Salesforce prevents calls to unauthorized network address

Author - Webner

We have a callout inside a class (using @future) which was throwing following exception:

Apex script unhandled exception by user/organization:005A0000001WKkE/00DA0000000KYuL

Failed to invoke future method ‘public static void invokeProcess(String, String, String, Decimal, String, String, String, Datetime, String, String)’ on class ‘FillAccordForrms’ for job id ‘707A000000AYXxu’ caused by: System.CalloutException: IO Exception: Unauthorized endpoint. Please check Setup->Security->Remote site settings.

endpoint = https://hostname:port/soa-infra/services/default/project/client_ep

Solution

Before any Apex callout can call an external site that site must be registered in the Remote Site
Settings page or the callout fails.

To add a remote site setting:

  • From Setup, click Security Controls | Remote Site Settings
  • Click New Remote Site
  • Enter a descriptive term for the Remote Site Name
  • Enter the URL for the remote site
  • Optionally, enter a description of the site
  • Click Save

You can also check the steps at official documentation here:

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_remote_site_settings.htm

Webner Solutions is a Software Development company focused on developing CRM apps (Salesforce, Zoho), LMS Apps (Moodle/Totara), Websites and Mobile apps. If you need Salesforce customization, App development or any other software development assistance please contact us at salesforce@webners.com

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Leave a Reply

Your email address will not be published. Required fields are marked *