“INVALID_PARTNER_NETWORK_STATUS, invalid status for partner network operation: ” exception occur if the “LocalRecordId” attribute of “PartnerNetworkRecordConnection” is incorrect.
List < PartnerNetworkRecordConnection > listConnections = new List < PartnerNetworkRecordConnection >();
PartnerNetworkRecordConnection connection = new PartnerNetworkRecordConnection();
connection.ConnectionId = network.Id;
connection.LocalRecordId = ‘0015Y00002dfRIF’;//Id of the record to be shared to the other Salesforce Org
listConnections.add( connection );