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
alaschgarialaschgari 

Salesforce to Salesforce: Testclass - PartnerNetworkRecordConnection Status from Invite to Accepted

Hey folks,

I'm writing a testclass for my Salesforce to Salesforce class. Here's the code so far:

 

public with sharing class sf42_TestClass
{
	public static testmethod void testAccountForwarding()
	{
		Test.startTest();
		Account a = sf42_TestDataGenerator.createTestAccount(1, true);
		Contact c = sf42_TestDataGenerator.createTestContact(1, a.Id, true);
		PartnerNetworkRecordConnection pnrc = [SELECT Status, LocalRecordId FROM PartnerNetworkRecordConnection WHERE LocalRecordId = :a.Id LIMIT 1];
		System.assertEquals(a.Id, pnrc.LocalRecordId);
		System.assertEquals('Invite', pnrc.Status);
		Test.stopTest();
	}
}

 How am I able to change the status 'Invite' to 'Accepted'?

EDIT: Sorry, I want to change it form 'invite' to 'Sent'!

 

Cheers

Josh

MoUsmanMoUsman

Hi alaschgari,

 

Please refer this link to create test for S2S http://boards.developerforce.com/t5/Apex-Code-Development/test-coverage-problem-for-salesforce-to-salesforce-connection/td-p/489959 

 

If this link is help ful to solve your problem please mar as solved to help other because it is a regular problam.

 

---

Thanks

Usman

alaschgarialaschgari

Hi MoUsman,

Thanks for your link, but no that doesn't solve the problem.

OlTuOlTu

Hi,

I ran into the same issue. 

Appreciate your help, if you could solve the problem.

 

Short description:

- Salesforce to Salesforce is configured

- Saving CONTACT Apex Trigger moves CONTACT to the target org

 

PROBLEM occures in my Test Class when saving Contact:

- Test class : 

   * Account is created.

   * PartnerNetworkRecordConnection is available but in status "Invite"