+ Start a Discussion
Jane NicolasJane Nicolas 

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){


    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') ,
    if(am != null && am.size() > 0){
insert am;}

Swayam  AroraSwayam Arora
Remove the single brackets i.e. decimal.valueof (opp.Plan_Number__c)

Please close the thread marking this answer as Best Answer if it really helped. Closing the thread help others finding the correct answer.
Jane NicolasJane Nicolas
Thanks SA