You need to sign in to do that
Don't have an account?
Swamy P
Not able to cover the test class for partnernetworkrecordconnection
Hello Team,
I was trying to share the opportunity record using apex(PartnerNetworkRecordConnection). So for that, i'm adding following snippet of code in test class:
Account a = new Account(Name='Acme1', BillingCity='San Francisco');
insert a;
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');
insert op1;
PartnerNetworkConnection networkConn =[select Id from PartnerNetworkConnection where ConnectionName = 'Services One' and ConnectionStatus = 'Accepted']; // and AccountId=:a.Id
PartnerNetworkRecordConnection newConnection = new PartnerNetworkRecordConnection(ConnectionId = networkConn.Id, LocalRecordId = op1.Id, ParentRecordId = op1.AccountId);
insert newConnection;
When i ran the test class, it is throwing the below error. Can anyone suggest us to resolve the issue.
System.DmlException: Insert failed. First exception on row 0; first error: INVALID_PARTNER_NETWORK_STATUS, invalid status for partner network operation: []
Thanks,
Swamy P R N
I was trying to share the opportunity record using apex(PartnerNetworkRecordConnection). So for that, i'm adding following snippet of code in test class:
Account a = new Account(Name='Acme1', BillingCity='San Francisco');
insert a;
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');
insert op1;
PartnerNetworkConnection networkConn =[select Id from PartnerNetworkConnection where ConnectionName = 'Services One' and ConnectionStatus = 'Accepted']; // and AccountId=:a.Id
PartnerNetworkRecordConnection newConnection = new PartnerNetworkRecordConnection(ConnectionId = networkConn.Id, LocalRecordId = op1.Id, ParentRecordId = op1.AccountId);
insert newConnection;
When i ran the test class, it is throwing the below error. Can anyone suggest us to resolve the issue.
System.DmlException: Insert failed. First exception on row 0; first error: INVALID_PARTNER_NETWORK_STATUS, invalid status for partner network operation: []
Thanks,
Swamy P R N
Please check once is there any validation rule or trigger on object PartnerNetworkRecordConnection.
Error :invalid status for partner network operation: []
If any required fields are there add tt the time of insertion insert PartnerNetworkRecordConnection .
PartnerNetworkRecordConnection newConnection = new PartnerNetworkRecordConnection(ConnectionId = networkConn.Id, LocalRecordId = op1.Id, ParentRecordId = op1.AccountId);
insert newConnection;
Hope it helps you.
Thanks
Varaprasad