In my Salesforce to Salesforce connection, each time a case is inserted and/or updated in my source org X, a PartnerNetworkRecordConnection is created (after insert and after update) to forward the case from source org X to target org Y. When the case is inserted into source org X, the AccountID lookup field that I have specified in the field ParentRecordId of the PartnerNetworkRecordConnection object will be correctly inserted in the case that was exported to target org Y.

However, if I update target org Y's AccountID lookup field that was mapped to ParentRecordId, the update will not be made to the corresponding lookup field in source org X.

Why is this?

My first guess is that PartnerNetworkRecordConnections do not support updates of ParentRecordId lookup fields, and if so, what is the solution to be able to update ParentRecordId lookup fields in one org, and for it to automatically update in the other?

The method that is called after insert and after update is as so:

 //PO autoforward to Contact
public static void autoforwardAggregatorCase(List<Case> caseList) {
    List<PartnerNetworkRecordConnection> conAggregatorInsertList = new List<PartnerNetworkRecordConnection>();
    S2S_Connection__c s2sAG = S2S_Connection__c.getValues('Connection');
    for(Case cse : caseList) {
        if(!AccountHelper.hasAlreadyCreatedAggregatorS2S()) {
            if(cse.RecordTypeId == Schema.SObjectType.Case.getRecordTypeInfosByName().get('Equipment Record').getRecordTypeId() && cse.Status != 'Draft' && cse.IsClosed == false) {
                PartnerNetworkRecordConnection newConnection =
                new PartnerNetworkRecordConnection(
                    ConnectionId = s2sAG.connection_id__c, // custom settings
                    LocalRecordId = cse.Id,
                    SendClosedTasks = false,
                    SendOpenTasks = false,
                    SendEmails = false,
                    ParentRecordId = cse.AccountId,
                    RelatedRecords = 'Capability__c,Attachment,CaseComment');
    if(conAggregatorInsertList.size() > 0) {
        if(!Test.isRunningTest()) {
            try {
                insert conAggregatorInsertList;
            } catch (DmlException e) {      if(e.getMessage().contains('INVALID_PARTNER_NETWORK_STATUS')) {
                    if(e.getMessage().contains('invalid status for partner network operation'))
                        caseList.get(0).addError('Record Sharing Error. Unable to share Case. Organisation is not currently shared.');
                        caseList.get(0).addError('Record Sharing Error. There are no valid Customer Connect connections.');



You must log in to answer this question.

Browse other questions tagged .