function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SurekaSureka 

Unable to access SplitTypeId field of OpportunitySplit in Apex class

Hi All,

I am trying to insert members into OpporutnitySplit with Apex Class:

OpportunitySplit opptySplit= new OpportunitySplit();               
opptySplit.OpportunityId = Id of Opportunity;
opptySplit.SplitPercentage = 100;
opptySplit.SplitTypeId = Id of Overlay Split ;
opptySplit.SplitOwnerId =Id of User;
insert opptySplit;

Getting the following error:

Invalid field SplitTypeId for SObject OpportunitySplit

Thanks
Sureka
lakslaks
Hi Sureka,

The description for SplitTypeId field in the OpportunitySplit object says that it is available in API version 28 and later.
http://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_opportunitysplit.htm

It would be a good idea to check if you are trying to use it in any other API version.

Regards,
Lakshmi.