Activity Forums Salesforce® Discussions What does it actually mean by the error “Arithmetic expressions must use numeric arguments”in Salesforce?

  • Deepak

    Member
    December 12, 2019 at 7:16 am

    You nearly made me forget the syntax there !! I've corrected the trigger above, try that to see if it works.

     

    You need to have a for loop to iterate over all the records that have invoked the trigger.

    Also a before trigger makes more sense, since you're manipulating values on the triggering records.

     

    trigger Peachtree_items_process on Peachtree_items__c (before update, before insert) {

     

    for( PeachTree_Items__c peachTreeItem : trigger.new) //iterate over all items
    if (peachTreeItem.Stock_Minimum__c != null  && peachTreeItem.Qty_On_Hand__c != null &&
    peachTreeItem.Qty_On_PO__c != null) {
    peachTreeItem.Stock_Reorder_Qty__c =
    peachTreeItem.Stock_Minimum__c -
    (peachTreeItem.Qty_On_Hand__c + peachTreeItem.Qty_On_PO__c);
    }
    }

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos