• shahrukh sheikh 7
  • NEWBIE
  • 0 Points
  • Member since 2017
  • Salesforce developer
  • Accenture

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
I am getting an error
System.DmlException: Insert failed. First exception on row 0; first error: INVALID_PARTNER_NETWORK_STATUS, invalid status for partner network operation: []
In my apex test class. i have created an apex batch class for sharing opportunity and have written apex test class for it but i am getting this error. Please suggest if have any solution.
here the test class...

@isTest(SeeAllData = true) public class batchLineItemInsert_Test { static testMethod void testMethod1() { Test.startTest(); Account a = new Account(Name='Acme1', BillingCity='San Francisco'); insert a; PartnerNetworkConnection networkConn =[select Id from PartnerNetworkConnection where ConnectionName = 'Services One' and ConnectionStatus = 'Accepted']; PartnerNetworkRecordConnection newConnection1 = new PartnerNetworkRecordConnection(ConnectionId = networkConn.Id, LocalRecordId = a.Id); insert newConnection1; Opportunity op1 = new Opportunity(Name='ChildTest123',Accountid=a.Id, StageName='2 - Qualified', CloseDate=System.today() - 50,Expected_Product__c=10.0,error_description__c='error',DealID__c='1',Opportunity_Status__c='Active',Position__c='Ministry of Hajj sasulima'); op1.CurrencyIsoCode = 'USD'; insert op1; PricebookEntry pbID= [SELECT Id,Name, PriceBook2Id, Product2Id, CurrencyIsoCode FROM PriceBookEntry where isActive = True and CurrencyIsoCode=:op1.CurrencyIsoCode limit 1]; OpportunityLineItem olli = new OpportunityLineItem (Quantity=2, OpportunityId=op1.Id, TotalPrice=10, PriceBookEntryId =pbID.Id); insert olli; FF_Batch_details__c ffbd = new FF_Batch_details__c(optyId__c=op1.Id, isActive__c=true, isLineItem__c=true); insert ffbd; PartnerNetworkRecordConnection newConnection = new PartnerNetworkRecordConnection(ConnectionId = networkConn.Id, LocalRecordId = olli.OpportunityId, ParentRecordId = op1.AccountId); insert newConnection; batchLineItemInsert obj = new batchLineItemInsert(); DataBase.executeBatch(obj); Test.stopTest(); } }