You need to sign in to do that
Don't have an account?

Error when create opportunity with custom field
I have create a custom field called "Opportunity_Referral" at Opportunity.
When I create a apex class like :
Opportunity opportunity1 = new Opportunity(StageName='Proposal', Name='TempOppName', CloseDate=system.today(), OpportunityReferral='WEB');
insert opportunity1;
It will have an error :
Error: Compile Error: Invalid field Opportunity_Referral for SObject Opportunity at line 3 column 139
Can anyone help me to solve this? Thank you very much.
When I create a apex class like :
Opportunity opportunity1 = new Opportunity(StageName='Proposal', Name='TempOppName', CloseDate=system.today(), OpportunityReferral='WEB');
insert opportunity1;
It will have an error :
Error: Compile Error: Invalid field Opportunity_Referral for SObject Opportunity at line 3 column 139
Can anyone help me to solve this? Thank you very much.
Simon

If its a custom field, dont you have to add "__c" onto the end of the fieldname?

It works! Thank you very much!
Simon