“INVALID_PARTNER_NETWORK_STATUS, invalid status for partner network operation: []” exception occur if the “LocalRecordId” attribute of “PartnerNetworkRecordConnection” is incorrect.
Sample Code:
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 );
insert listConnections;