You need to sign in to do that
Don't have an account?
Tomeka Wray
error: INVALID_PARTNER_NETWORK_STATUS, invalid status for partner network operation:
I have seen post for this error but no solution, so I am posting again in hopes of getting an answer. I am trying to send a record to a Salesforce to Salesforce connection if it meets certain parameters. However, received the error posted in the subject line. Below is the code that I am trying to execute:
trigger SimpleCaseTrigger on Case (after update) {
// Define connection id
Id networkId = ConnectionHelper.getConnectionId('Connection Name');
List <Case> sendToConn = New List<Case>();
List<PartnerNetworkRecordConnection> prncList = new List<PartnerNetworkRecordConnection>();
for (Case c : Trigger.New){
//Test to that the case has been successfully closed and has not been sent to Connection Before
if (c.ConnectionReceivedId == null && c.ConnectionSentID == null && c.Status == 'Successfully Closed'){
sendToConn.add(c);
System.debug('Case #'+ c.CaseNumber + ' added.');
}
}
//Create Connection to send to Connection
for (Case newCases : sendToConn){
PartnerNetworkRecordConnection newConnection =
new PartnerNetworkRecordConnection(
ConnectionId = networkId,
LocalRecordId = newCases.Id,
SendClosedTasks = false,
SendOpenTasks = false,
SendEmails = false,
ParentRecordId = newCases.AccountId);
prncList.add(newConnection);
}
database.insert(prncList);
}
trigger SimpleCaseTrigger on Case (after update) {
// Define connection id
Id networkId = ConnectionHelper.getConnectionId('Connection Name');
List <Case> sendToConn = New List<Case>();
List<PartnerNetworkRecordConnection> prncList = new List<PartnerNetworkRecordConnection>();
for (Case c : Trigger.New){
//Test to that the case has been successfully closed and has not been sent to Connection Before
if (c.ConnectionReceivedId == null && c.ConnectionSentID == null && c.Status == 'Successfully Closed'){
sendToConn.add(c);
System.debug('Case #'+ c.CaseNumber + ' added.');
}
}
//Create Connection to send to Connection
for (Case newCases : sendToConn){
PartnerNetworkRecordConnection newConnection =
new PartnerNetworkRecordConnection(
ConnectionId = networkId,
LocalRecordId = newCases.Id,
SendClosedTasks = false,
SendOpenTasks = false,
SendEmails = false,
ParentRecordId = newCases.AccountId);
prncList.add(newConnection);
}
database.insert(prncList);
}
Also, these are test records so I am creating them myself so that I know they didn't come from another connection.
Is there anything else that would generate this error? Thanks.
Did you solved this issue?
Were you able to solve this issue. Pleas provide pointers if you were. I just ran the following script and got the error:
List<PartnerNetworkRecordConnection> objectConnections = new List<PartnerNetworkRecordConnection>();
objectConnections.add(
new PartnerNetworkRecordConnection(
ConnectionId = 'XXXXXXX',
LocalRecordId = 'YYYYYYYY',
SendClosedTasks = false,
SendOpenTasks = false,
SendEmails = true,
ParentRecordId = 'ZZZZZZZZZZ',
RelatedRecords = null ));
upsert objectConnections;
Line: 12, Column: 1
System.DmlException: Upsert failed. First exception on row 0; first error: INVALID_PARTNER_NETWORK_STATUS, invalid status for partner network operation: []