You need to sign in to do that
Don't have an account?
S2S - Error INVALID_PARTNER_NETWORK_STATUS
I am trying to auto sync a child record which is a child of account. I am getting this error, though the account is getting synced properly. I have written a trigger on the child object. Code given below. Any suggestions how to fix this?
trigger AdressS2s on Address_vod__c (after insert, after update) {
// Define connection id
Id networkId = ConnectionHelper.getConnectionId('sss');
Set<Id> localAddressAccountSet = new Set<Id>();
List<Address_vod__c> localAddress_vod_cs = new List<Address_vod__c>();
Set<Id> sharedAccountSet = new Set<Id>();
// only share records created in this org, do not add contacts received from another org.
for (Address_vod__c newAddress_vod_c: TRIGGER.new) {
localAddress_vod_cs.add(newAddress_vod_c);
}
System.debug('Inside address trigger -->');
//if (sharedAccountSet.size() > 0) {
List<PartnerNetworkRecordConnection> Address_vod_cConnections = new List<PartnerNetworkRecordConnection>();
for (Address_vod__c newAddress_vod_c: localAddress_vod_cs) {
// if (sharedAccountSet.contains(newAddress_vod_c.Account_vod__c)) {
System.debug('Inside address trigger final loop -->'+ newAddress_vod_c);
PartnerNetworkRecordConnection newConnection =
new PartnerNetworkRecordConnection(
ConnectionId = networkId,
LocalRecordId = newAddress_vod_c.Id,
SendClosedTasks = false,
SendOpenTasks = false,
SendEmails = false,
ParentRecordId = newAddress_vod_c.Account_vod__c);
Address_vod_cConnections.add(newConnection);
//}
}
if (Address_vod_cConnections.size() > 0 ) {
System.debug('Size greater than 0 -->'+ Address_vod_cConnections);
try{
database.insert(Address_vod_cConnections);
}
Catch(exception ex){
System.debug('exception in sending'+ex.getmessage());
}
}
}
//}
Your question is incomplete. What are you auto-syncing in your child record? What is the nature of this "sync"? Also, what error message do you get? Can you highlight the line which throws the error message?
Anup
The error message comes on the line database.insert operation. Nature of sync is push i..e the trigger code is written on the source org and on the target org it has been auto subscribed to a few fields to the source.