• Gaither Simmons
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
In my test class I need to create an opportunity to test against. 

            //Create Opportunity
            // set up opp and Verify that the results are as expected.
            RecordType SigSales = [select Id from RecordType where Name = 'Sigma Sales' and SobjectType = 'Opportunity'];
            String opportunityName = 'My TEST Opportunity';

            Opportunity opp1 = new Opportunity(
                //AccountId=testAccount.Id, 
                Name=opportunityName, 
                StageName='Idea',
                CloseDate=Date.today(),
                RecordType=SigSales
            );
            insert opp1;

When I run the test I get the following error: 
11:12:43.788 (12788478666)|VF_PAGE_MESSAGE|You can't create an Opportunity Split for a user unless they're part of the opportunity team.
11:12:43.788 (12788578660)|EXCEPTION_THROWN|[77]|System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, You can't create an Opportunity Split for a user unless they're part of the opportunity team.: [SplitOwnerId]
11:12:43.789 (12789451592)|HEAP_ALLOCATE|[77]|Bytes:196
11:12:43.797 (12797690786)|FATAL_ERROR|System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, You can't create an Opportunity Split for a user unless they're part of the opportunity team.: [SplitOwnerId]

Class.TestAddSAFromAccounttoOpp.myUnitTest: line 77, column 1
11:12:43.797 (12797713236)|FATAL_ERROR|System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, You can't create an Opportunity Split for a user unless they're part of the opportunity team.: [SplitOwnerId]

I am not attempting to create any splits. Not sure what is going on here. 

Thanks!
Gaither