Salesforce supports making Apex callouts from one Salesforce org (Org A) to another Salesforce org (Org B) using REST or SOAP web services. This is useful when two Salesforce orgs need to exchange data in real time — for example, when a company manages a subsidiary in a separate Salesforce org and needs to trigger record creation in Org B from a process running in Org A.
To implement this, Org B exposes a web service, and Org A makes an outbound callout to invoke it. Org A must have Org B's endpoint registered in its Remote Site Settings before the callout can succeed.
Important constraint: Org B must not make any further outbound callouts as part of the same transaction. Salesforce does not allow callouts from within a callout context (a callout cannot trigger another callout).
1. In Org B, create an Apex class with a web service method. For example, create a class named AccountPlan containing a method createAccountPlan() that performs the desired operation and returns a String result. Mark the method with the webservice keyword so it can be exposed as a WSDL-based web service.
2. Once the class is created, generate the WSDL for the class from Setup | Apex Classes, and download it.
1. In Org A, use the downloaded WSDL to auto-generate the stub classes: navigate to Setup | Apex Classes | Generate from WSDL. This creates a stub class (for example, soapSforceComSchemasClassAccplan and AsyncSoapSforceComSchemasClassAccplan )
2. Create an Apex class as follows:
@RestResource(urlMapping='/createAccountPlan/*')
global with sharing class CallAccountPlan{
@HttpGet
global static String doGet(){
soapSforceComSchemasClassAccplan.AccountPlan stub = new soapSforceComSchemasClassAccplan.AccountPlan();
stub.SessionHeader = new soapSforceComSchemasClassAccplan.SessionHeader_element();
stub.SessionHeader.sessionId = Session Id;
return stub.createAccountPlan();
}
}
@RestResource annotation (for example, /services/apexrest/createAccountPlan/).createAccountPlan() method.
Conclusion:
When a REST web service in Org A is called by an external system, that REST service can in turn make callouts to other Salesforce orgs, provided Org B does not make further callouts within the same transaction.
000387962

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.