Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Salesforce Production org 1 -

Class AccountUtil
{
    public String ValidateAccount(String AccountName)
    {
        //validation logic
        return 'validation result';
    }
}

Salesforce Production Org 2 - has all accounts and data.

I want to call AccountUtil.ValidateAccount('Test Company'); method from Salesforce org 2 in apex is it possible ?

I am interested in options other than SOAP web-service.

share|improve this question
    
What org do you want the apex code to run against, org1 or org2? –  Ryan Guest Dec 26 '12 at 2:31
    
@RyanGuest is Production to Production –  Prafulla Patil Jan 2 '13 at 22:14

1 Answer 1

up vote 2 down vote accepted

You can Use REST API .All you need is to do an oauth between the two systems and then you can call any exposed API

http://wiki.developerforce.com/page/Digging_Deeper_into_OAuth_2.0_on_Force.com

Refer the above documents for oauth 2.0 implementation.

http://wiki.developerforce.com/page/Creating_REST_APIs_using_Apex_REST

Follow the above to understand how to create the API.

Sample REST API class

@RestResource(urlMapping='/Demorest/')
global Class AccountUtil{
@HttpGet
public String ValidateAccount(){
    String AccountName =RestContext.request.params.get('accountname');
    //validation logic
    return 'validation result';
  }
 }
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.