function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Amolikhe123Amolikhe123 

How to use Salesforce webservice in Apex code?

Hi

 

can anybody have an idea how can we can consume an internal salesforce webservice(Partner WSDL) in apex code?

 

I want to insert a record from one salesforce organization to another organization.  I have created a form which needs to insert a contact record to another organization contact object.

 

 

How can we insert the record to different Organization using webservice?

 

 

Thanks 

werewolfwerewolf
See the section of the Apex docs entitled "Invoking Callouts From Apex."
Amolikhe123Amolikhe123

Thanks for your reply...

 

can you provide the code snippet  for inserting the contact using salesforce partner API in apex code..

 

 

this is quite urgent ..

 

it will help in great deal...

 

Thanks

werewolfwerewolf

Why would you be using the Salesforce.com partner API in Apex?  Those two things are mutually exclusive.

 

If you're just looking for sample code that shows inserting records using Apex, then see the App Logic page here or the Force.com Cookbook.

werewolfwerewolf
Oh wait a minute.  You're trying to insert a contact from one org to another?  Don't write code for that!!!!  Use Salesforce-to-salesforce.  Look that up in the docs.
AmolIkheAmolIkhe

Thanks for your reply...

 

But in my situation i need to create acustom apex form(registration) whith some fields and wants to insert these fields(in to other organisation) when customer hits submit.

 

Can i use Salesforce to salesforce in apex code ?

 

waiting for your reply...

 

Thanks

 

Gagandeep-SinghGagandeep-Singh
Consuming sf wsdl within sf is not allowed.it would be comparatively easier to create a sf email service and email handler class in target org to process the content of incoming email and send entered content from source org from your controller using SendEmail() method.

thanks