+ Start a Discussion
SFDCTech1SFDCTech1 

Got error Invalid initial expression type for field in opportunity, expecting: Decimal

Error: Compile Error: Invalid initial expression type for field Opportunity.Primary_Industry_Percent__c, expecting: Decimal

 

Opportunity Opp= new Opportunity(Name='Sample',
Account=AC,
Opportunity_Type__c='New',


Primary_Industry__c='Consumer Goods',
Primary_Industry_Percent__c='20',

Praveen KimarPraveen Kimar

Hi,

 

Primary_Industry_Percent__c='20',

Convert the value into decimal before assigning it to the field.

Primary_Industry_Percent__c=decimal.valueof('20');

 

Please mark it as solution if it resolves your issue.