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
Tomeka WrayTomeka 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'){
            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);
James LoghryJames Loghry
Sounds like the Case object has not been subscribed.  Per this document:
Attempting to forward a record from an object to which the connection is not subscribed results in an Invalid Partner Network Status error.

Don’t forward a record to the connection that originally shared it. Doing so causes errors when Apex triggers run.

Tomeka WrayTomeka Wray
Thanks for the response. But I am able to send the records manually and they show up in the other organization. So, I know the connections are working.

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.
Sankalp VyasSankalp Vyas
Hello Tomeka,
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>();  
                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: []
Always ThinkinAlways Thinkin
Really excellent blog post that covers a lot of the configurations to check when getting this error: