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

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;}


}
}
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