0

I have two Salesforce orgs (Alpha & Beta).

Both of them are developer orgs and both of them exist in ap2.salesforce.com.

The scenario that I am trying to implement is as soon as expense is created in Alpha the same expense data will be created in Beta also.

There is a POST REST Class created in Beta which can accept Expense data and insert it in it's org.

@RestResource(urlMapping='/Expense/*')
global class ExpenseWS {
    @HttpPost
    global static void createExpense(String ExpenseName,String Type,Integer Amount) {    
        Expenses__c e = new Expenses__c();

        e.Expense_Name__c = ExpenseName;
        e.Type__c = Type;
        e.Amount__c = Amount;

        insert e;
    }
}

Alpha calls Beta via Webservice callout (from trigger) as shown below.

trigger ExpenseIntegrate on Expense__c (after insert) {
    IntegrateExpenses.sendExpense(Trigger.new[0].Expense_Name__c,Trigger.new[0].Type__c,Integer.valueOf(Trigger.new[0].Amount__c));
}

I am not able to proceed further because I am not sure how to set the endpoint aka the URI of the REST class from Beta.

I thought I can set something like shown below but I am pretty sure that this is wrong as https://ap2.salesforce.com does not uniquely identify the second org (Beta)

enter image description here

Can someone tell me how to do this ?

1

You have to use OAuth to establish the connection first then only you can call the rest method from a different org. Please find this SFSE link for details. How can i integrate one SFDC org to another SFDC using Rest Api

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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