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

System.TypeException: Invalid decimal in creating Trigger
hi all I was getting following error "System.TypeException: Invalid decimal: opp.Plan_Number__c: Trigger.OpportunityTrigger: line 10, column 1" for the below trrigger when tried creating a record in opportunity. my trigger was :
trigger OpportunityTrigger on Opportunity (after insert, after update){
if(Trigger.isInsert){
List<AccountManagement__c> am = new List <AccountManagement__c>();
for(Opportunity opp : trigger.new){
AccountManagement__c a = new AccountManagement__c
(Planholder__c = opp.Planholder_Name__c,
Plan_Number__c = decimal.valueof ('opp.Plan_Number__c') ,
Name='');
am.add(a);
}
if(am != null && am.size() > 0){
insert am;}
}
}
trigger OpportunityTrigger on Opportunity (after insert, after update){
if(Trigger.isInsert){
List<AccountManagement__c> am = new List <AccountManagement__c>();
for(Opportunity opp : trigger.new){
AccountManagement__c a = new AccountManagement__c
(Planholder__c = opp.Planholder_Name__c,
Plan_Number__c = decimal.valueof ('opp.Plan_Number__c') ,
Name='');
am.add(a);
}
if(am != null && am.size() > 0){
insert am;}
}
}
Please close the thread marking this answer as Best Answer if it really helped. Closing the thread help others finding the correct answer.