2022, 00:00 Salesforce to Salesforce Integration Using REST API and OAuth
Этот сайт использует файлы cookie Google. Это необходимо для его нормальной работы и анализа
Search this blog
трафика. Информация о вашем IP-адресе и агенте пользователя, а также показатели производительностиSalesforce CPQ Ad
и безопасности передаются в Google. Это помогает обеспечивать качество услуг, накапливать статистику
Email Template
использования, а также выявлять и устранять нарушения.
August 27, 2020
ПОДРОБНЕЕ ОК
Responsive Advertisement
Popular Posts
Categories
Lets Start with Salesforce to Salesforce Integration Using REST API and OAuth.
Here I wanted to Access the All contacts for an Account From Target Org(2nd Salesforce
Org)
Step-1:
Tags
In Source Org Create one Connected App:
Change the Oauth CallBack URL according to your instance. Here my instance is "CS30"
https://cs30.salesforce.com/services/oauth2/callback
Featured Post
After Save you will get Consumer Key & Consumer Secret
amulhai.blogspot.com/2015/11/salesforce-to-salesforce-integration.html 1/13
21.02.2022, 00:00 Salesforce to Salesforce Integration Using REST API and OAuth
Этот сайт использует файлы cookie Google. Это необходимо для его нормальной работы и анализа
трафика. Информация о вашем IP-адресе и агенте пользователя, а также показатели производительности
Salesforce CPQ Ad
и безопасности передаются в Google. Это помогает обеспечивать качество услуг, накапливать статистику
Email Template
использования, а также выявлять и устранять нарушения.
August 27, 2020
ПОДРОБНЕЕ ОК
Popular Posts
Salesf
Integr
and O
After this now we have to Develop one Apex RestService in the Same Source Org. Facebook
Categories
1. @RestResource(urlMapping='/v1/getContacts/*')
2. global with sharing class getContact {
3. @Httpget
4. global static list<contact> fetchAccount(){
5. RestRequest req = RestContext.request; Tags
6. RestResponse res = Restcontext.response;
7. Id accId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
8. list<contact> lstcontact =[Select id , name,Phone,Fax,Email from contact where Accountid=:accId ];
9.
0. return lstcontact ;
1. }
2. }
Step-3: Now we have to consume the above Apex Rest Service in Target Salesforce Org.
clientId
clientSecret
username
password
Also Change the Endpoint(line no.18) in which org you are trying to login. means where
you have create your Connected App
req.setEndpoint('https://test.salesforce.com/services/oauth2/token');
Also Change the Endpoint(line no.32) in which org you are trying to access all the Contacts.
means where you have developed your Apex RestService
APEX CLASS
*********************************************************************
public class SendAccountUsingRESTAPI {
private final String clientId = 'XXXX1qDQKpai6KLQyEHS3pvpCcteS2b5rWP2A6JpuqP._w2byvgpP8EC56LtyV
private final String clientSecret = '17825308XXX';
private final String username = 'abaranwal@kloudrac.com.full';
amulhai.blogspot.com/2015/11/salesforce-to-salesforce-integration.html 2/13
21.02.2022, 00:00 Salesforce to Salesforce Integration Using REST API and OAuth
private final String password = 'XXX';
Salesf
HttpRequest req = new HttpRequest();
Integr
req.setBody(reqbody);
and O
req.setMethod('POST');
req.setEndpoint('https://test.salesforce.com/services/oauth2/token');
HttpResponse res = h.send(req);
Facebook
deserializeResponse resp1 = (deserializeResponse)JSON.deserialize(res.getbody(),deserializeResponse.cla
system.debug('@@@@access_token@@'+resp1 );
return resp1.access_token;
}
public static list<Contact> callgetContact (String accId)
Categories
{
SendAccountUsingRESTAPI acount1 = new SendAccountUsingRESTAPI();
String accessToken;
accessToken = acount1.ReturnAccessToken (acount1);
list<Contact> LstContact=new List<Contact>();
Tags
if(accessToken != null){
String endPoint = 'https://cs30.salesforce.com/services/apexrest/v1/getContacts/' +accId;
//String jsonstr = '{"accId" : "' + accId+ '"}';
Http h2 = new Http();
HttpRequest req1 = new HttpRequest();
req1.setHeader('Authorization','Bearer ' + accessToken);
req1.setHeader('Content-Type','application/json');
req1.setHeader('accept','application/json');
//req1.setBody(jsonstr);
req1.setMethod('GET');
req1.setEndpoint(endPoint);
HttpResponse res1 = h2.send(req1);
String trimmedResponse = res1.getBody().unescapeCsv().remove('\\');
system.debug('@@@RESPONSE@@'+trimmedResponse);
JSONParser parser = JSON.createParser(res1.getBody());
set<Contact> contList=new set<Contact>();
while (parser.nextToken() != null) {
//Id
if((parser.getCurrentToken() == JSONToken.FIELD_NAME) ){
Contact cont;
if ((parser.getCurrentToken() == JSONToken.FIELD_NAME) && (parser.getText() == 'Id')) {
// Get the value.
parser.nextToken();
// Compute the grand total price for all invoices.
string sId= parser.getText();
Featured Post
cont=new Contact();
cont.Id=sId;
system.debug('Id@@@' + sId);
parser.nextToken();
if ((parser.getCurrentToken() == JSONToken.FIELD_NAME) &&
(parser.getText() == 'Name')) {
amulhai.blogspot.com/2015/11/salesforce-to-salesforce-integration.html 3/13
21.02.2022, 00:00 Salesforce to Salesforce Integration Using REST API and OAuth
// Get the value.
}
Popular Posts
//Email
parser.nextToken();
Salesf
if ((parser.getCurrentToken() == JSONToken.FIELD_NAME) &&
Integr
(parser.getText() == 'Email')) {
and O
// Get the value.
parser.nextToken();
// Compute the grand total price for all invoices.
string sEmail= parser.getText();
Facebook
cont.Email=sEmail;
system.debug('Email@@@' + sEmail);
}
Categories
}
contList.add(cont);
}
Tags
contList.remove(null);
}
LstContact.AddAll(contList);
system.debug('ContList@@@@'+Json.serialize(LstContact));
}
return LstContact;
}
}
*********************************************************************
Yes now we are ALL set, you can call this "callgetContact " in your visualforce Controller Class
or in your Apex Trigger wherever you wanted to Show the List of Contacts..from Source
Org.
REACTIONS
Facebook Twitter
amulhai.blogspot.com/2015/11/salesforce-to-salesforce-integration.html 4/13
21.02.2022, 00:00 Salesforce to Salesforce Integration Using REST API and OAuth
Этот сайт использует файлы cookie Google. Это необходимо для его нормальной работы и анализа
трафика. Информация о вашем IP-адресе и агенте пользователя, а также показатели производительности
Salesforce CPQ Ad
и безопасности передаются в Google. Это помогает обеспечивать качество услуг, накапливать статистику
Email Template
OLDER использования, а также выявлять и устранять нарушения. NEWER
Post RecordFile to Chatter Group PMT Method in Salesforce/ PMT Function in August 27, 2020
ПОДРОБНЕЕ ОК Salesforce
Salesf
Integr
and O
Salesforce CPQ Advance Salesforce CPQ: Theta Symbol Salesforce CPQ Data
Facebook
Approval Email Template in Quote PDF Migration
Advance approval - CPQ - April 20, 2020 CPQ Data Migration -
August 27, 2020 March 15, 2020
Categories
Post a Comment
51
Comments
Unknown Tags
26 November 2015 at 09:02
Prefect Solution.
Reply Delete
Anonymous
26 November 2015 at 09:15
Its really good steps to Salesforce to Salesforce Integration Using REST API and
OAuth .
Reply Delete
Anonymous
26 November 2015 at 19:31
Reply Delete
Unknown
26 February 2016 at 11:12
Reply Delete
Unknown
26 February 2016 at 11:13 Featured Post
Reply Delete
AMUL BARANWAL
6 April 2016 at 12:55
amulhai.blogspot.com/2015/11/salesforce-to-salesforce-integration.html 5/13
21.02.2022, 00:00 Salesforce to Salesforce Integration Using REST API and OAuth
what
Этот сайт legacy system
использует you have.
файлы we can
cookie integrateЭто
Google. withнеобходимо
java, .net для его нормальной работы и анализа
трафика. Информация о вашем IP-адресе и агенте пользователя, а также показатели производительности Salesforce CPQ Ad
Delete
и безопасности передаются в Google. Это помогает обеспечивать качество услуг, накапливать статистику
Email Template
использования, а также выявлять и устранять нарушения.
August 27, 2020
Unknown ПОДРОБНЕЕ ОК
6 April 2016 at 07:55
I hope this is the custom REST api, correct me if I'm wrong Popular Posts
Reply Delete
Salesf
AMUL BARANWAL Integr
6 April 2016 at 12:54 and O
Delete
Facebook
TestUser
14 June 2016 at 05:26
Reply Delete
I did get your point. If Data Transfer you are looking from org to another
Org. use ETL tool or Dataloader CLI.
Delete
Unknown
22 September 2016 at 05:27
Reply Delete
Anonymous
16 December 2016 at 00:48
Reply Delete
Unknown
26 January 2017 at 08:24
Can you please share the visual force code too. thanks
Reply Delete
Featured Post
Unknown
26 January 2017 at 21:50
thanks for your information excelllent blog good support for salesforce
Reply Delete
amulhai.blogspot.com/2015/11/salesforce-to-salesforce-integration.html 6/13
21.02.2022, 00:00 Salesforce to Salesforce Integration Using REST API and OAuth
Prakash Kumar P
3 Этот сайт
March 2017 использует файлы cookie Google. Это необходимо для его нормальной работы и анализа
at 04:27
трафика. Информация о вашем IP-адресе и агенте пользователя, а также показатели производительности
Salesforce CPQ Ad
и безопасности передаются в Google. Это помогает обеспечивать качество услуг, накапливать статистику
When we login with user name and password, salesforce also provides a security Email Template
использования, а также
token string that must выявлять
be appended to theи password.
устранять нарушения.
How is that handled here?
August 27, 2020
Should we hardcode that security token in the code? when the password/token
ПОДРОБНЕЕ ОК
changes for the integrated user, the code must be changed??
Hi,
and O
I am trying to learn integration using the code you provided. However when I try to
display contact information from source org in my destination org(using vf page) I
get the error :
Status Unexpected character ('<' (code 60)): expected a valid value (number, String, Facebook
array, object, 'true', 'false' or 'null') at input location [1,2]
02:06:53.0 (8960006)|CALLOUT_REQUEST|
[19]|System.HttpRequest[Endpoint=https://ravideepappbuilder-dev-
ed.my.salesforce.com/oauth2/token, Method=POST]
02:06:53.0 (69643751)|CALLOUT_RESPONSE|[19]|System.HttpResponse[Status=Not
Found, StatusCode=404]
Categories
I think it means my endpoint url is wrong but I did how it was asked and still doesn't
work.Here's my endpoint url:
https://ravideepappbuilder-dev-ed.my.salesforce.com/oauth2/token
Reply Delete
Dhiraj
7 November 2019 at 11:32
Hi, hope it's resolved for you. if not, let me tell you, you missed to add
'/services'. Use below.
https://ravideepappbuilder-dev-
ed.my.salesforce.com/services/oauth2/token
Delete
SALESFORCE
13 July 2017 at 23:03
I acknowledge the author for his brilliant work for making this exceptionally useful
and informative content to guide us.
salesforce integration
Reply Delete
sasiraja
4 November 2017 at 08:15
Very good and easy understanding, Why cant you add a VF page code as well where
all contacts are organized in pageblocktable.
Reply Delete
Featured Post
Unknown
22 January 2018 at 23:45
Reply Delete
Data Perusal Consultancy Pvt. Ltd.
amulhai.blogspot.com/2015/11/salesforce-to-salesforce-integration.html 7/13
21.02.2022, 00:00 Salesforce to Salesforce Integration Using REST API and OAuth
Bruce Do
22 May 2018 at 21:19 Salesf
Integr
For every request, it'll take 2 api calls. 1- get access_token and 2 - get contact. Can and O
we store the access_token in somewhere, check the token valid. if not, we'll refresh
the token, if token still valid, we can continue use it.
Nikhil Somvanshi
6 November 2018 at 02:36
Categories
Delete
mathimathi
1 November 2018 at 02:50
Tags
So nice to read.Its very useful for me to get more valuable info about Medical Billing
Coding Service.Thanks for it.Keep going.
Reply Delete
mathimathi
1 November 2018 at 02:51
Most of the healthcare institutes are procuring the software packages for their
coding and billing process from medical
Salesforce Training |
Reply Delete
Unknown
23 February 2019 at 16:48
Reply Delete
JC
4 March 2019 at 22:19
Hi, I am trying perform the same as per this post, and my code is also similar except
the Parser Instance. But I am getting an error when I tried to run the class through Featured Post
Anonymous window. The error is "System.HttpResponse[Status=Bad Request,
StatusCode=400]". Any help would be highly appreciated. Thanks!
Reply Delete
manisha
27 March 2019 at 04:03
amulhai.blogspot.com/2015/11/salesforce-to-salesforce-integration.html 8/13
21.02.2022, 00:00 Salesforce to Salesforce Integration Using REST API and OAuth
Thankсайт
Этот you for sharing suchфайлы
использует great information very useful
cookie Google. Этоtoнеобходимо
us.
для его нормальной работы и анализа
Salesforce Training in Gurgaon
трафика. Информация о вашем IP-адресе и агенте пользователя, а также показатели производительности Salesforce CPQ Ad
и безопасности передаются в Google. Это помогает обеспечивать качество услуг, накапливать статистику
Email Template
использования, а также выявлять и устранять нарушения.
Reply Delete August 27, 2020
ПОДРОБНЕЕ ОК
Mohit Bansal
3 April 2019 at 01:56
Popular Posts
Really nice post, Thanks for sharing such an informative post.
Facebook
I really enjoyed while reading your article and it is good to know the latest updates.
Do post more. Please also read my topics about
Salesforce Products
Salesforce Consultant
Salesforce Integration Service
Categories
Reply Delete
Onpeaks
12 July 2019 at 04:17
Tags
ExpressTech Software Solutions is known as best custom Rest API Integration
Services in India, USA, has the best in the industry specialization to deliver seamless
API integration and development services. Our system integration services make
sure that your web application or website is without flawlessly integrated with the
standard or custom APIs.
Reply Delete
Unknown
27 August 2019 at 03:11
Thank you
Reply Delete
Venkat
25 October 2019 at 02:07
Reply Delete
Dhiraj
7 November 2019 at 11:31
Reply Delete
Unknown
15 December 2019 at 09:02
Featured Post
I want to insert those contact records in target org. Please help me out of this.....I
need full code for inserting.......
Reply Delete
Saurabh
amulhai.blogspot.com/2015/11/salesforce-to-salesforce-integration.html 9/13
21.02.2022, 00:00 Salesforce to Salesforce Integration Using REST API and OAuth
I wantсайт
Этот to insert these contacts
использует файлыin target org. Google.
cookie Please help???
Это необходимо для его нормальной работы и анализа
трафика. Информация о вашем IP-адресе и агенте пользователя, а также показатели производительности Salesforce CPQ Ad
Reply Delete
и безопасности передаются в Google. Это помогает обеспечивать качество услуг, накапливать статистику
Email Template
использования, а также выявлять и устранять нарушения.
Jade Global August 27, 2020
24 January 2020 at 00:55
ПОДРОБНЕЕ ОК
Salesf
Salesforce integration services
Integr
Salesforce service cloud integration
and O
salesforce optimization
Reply Delete
Facebook
salesforce Certifications
19 February 2020 at 23:53
Reply Delete
Sachin Gupta
27 January 2021 at 01:53
Tags
Trading has become easier and comfortable with online trading applications.
Reply Delete
Manoj
21 July 2021 at 06:28
Salesforce Billing training india, Salesforce Online training Contact us@ +91
9550102466.
Reply Delete
rao77
21 July 2021 at 13:59
Reply Delete
Prakash
30 July 2021 at 03:04
amulhai.blogspot.com/2015/11/salesforce-to-salesforce-integration.html 10/13
21.02.2022, 00:00 Salesforce to Salesforce Integration Using REST API and OAuth
you have
Этот сайтwritten an excellent
использует blog.. cookie
файлы keep sharing yourЭто
Google. knowledge...
трафика. Информация о вашем IP-адресе и агенте пользователя, а также показатели производительности Salesforce CPQ Ad
Python Automation Testing Course
и безопасности передаются в Google. Это помогает обеспечивать качество услуг, накапливать статистику
Selenium with Python Training
Email Template
использования, а также выявлять и устранять нарушения.
Selenium with Python Course
August 27, 2020
Selenium with Java Training
ПОДРОБНЕЕ ОК
Selenium with Java Course
Reply Delete
Salesf
bhanu Integr
17 August 2021 at 03:28 and O
Reply Delete
raghu
1 September 2021 at 05:09
Categories
Great Content. It will useful for knowledge seekers. Keep sharing your knowledge
through this kind of article.
Reply Delete
bhanu
2 September 2021 at 02:04
Reply Delete
kumar
23 September 2021 at 04:53
Reply Delete
bhanu
26 September 2021 at 01:48
Reply Delete
Keerthi55
28 September 2021 at 22:35
amulhai.blogspot.com/2015/11/salesforce-to-salesforce-integration.html 11/13
21.02.2022, 00:00 Salesforce to Salesforce Integration Using REST API and OAuth
salesforce online training
Этот сайт использует файлы cookie Google. Это необходимо для его нормальной работы и анализа
трафика. Информация о вашем IP-адресе и агенте пользователя, а также показатели производительности
Reply Delete
Salesforce CPQ Ad
и безопасности передаются в Google. Это помогает обеспечивать качество услуг, накапливать статистику
Email Template
Unknown
использования, а также выявлять и устранять нарушения.
August 27, 2020
19 December 2021 at 21:44
ПОДРОБНЕЕ ОК
Popular Posts
Networking Projects
and O
The Angular Training covers a wide range of topics including Components, Angular
Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular
Facebook
programmability. The new Angular TRaining will lay the foundation you need to
specialise in Single Page Application developer. Angular Training
Reply Delete
Your blog is very nice… I got more information about your blog page… Thanks for
sharing your information…
Visit link
Tags
Best Hospital management software in Mumbai
Visit link
Visit link
Reply Delete
Lavanya
4 February 2022 at 18:23
Reply Delete
amulhai.blogspot.com/2015/11/salesforce-to-salesforce-integration.html 12/13
21.02.2022, 00:00 Salesforce to Salesforce Integration Using REST API and OAuth
Salesforce CPQ Data Migration
Этот сайт использует файлы cookie Google. Это необходимо для его нормальной работы и анализа
трафика. Информация о вашем IP-адресе и агенте пользователя, а также показатели производительности
Salesforce CPQ Ad
и безопасности передаются в Google. Это помогает обеспечивать качество услуг, накапливать статистику
Email Template
использования, а также выявлять и устранять нарушения.
August 27, 2020
Created By SoraTemplates | Distributed By Blogger Template ПОДРОБНЕЕ ОК Home About Contact Us
Popular Posts
Salesf
Integr
and O
Categories
Tags
amulhai.blogspot.com/2015/11/salesforce-to-salesforce-integration.html 13/13