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
Josh GitogoJosh Gitogo 

Receiving error called: 'Arithmetic expressions must use numeric arguments'

I am not sure why this error is popping up or what this error means. Can someone help me out. Here is a sample of the code I used:
trigger AutoInventory on Sol_sence_Sample__c (before insert, before update) 
{
    If(Trigger.IsInsert || Trigger.IsUpdate)
    {
        for(Sol_sence_Sample__c co : Trigger.New)
        {
            If(co.Shipped__c == 'checked' && co.sol_sence_inventory__c != null && co.Quantity__c != null)
            {
                	co.Sol_sence_Inventory__c = co.Sol_sence_Inventory__c - co.Quantity__c;
            }
        }
    }
}

 
Gagan Gupta 32Gagan Gupta 32
i think the datatype of Sol_sence_Inventory__c and Quantity__c are different, thats why you are getting this error.


Please mark as best answer if resolved.
Shruti SShruti S

+1 to all.

You can achieve this requirement with the help of Processes/Workflows with which you can avoid writing Apex in your Org and also escape from writing Unit Tests ;)

If you can expand your requirements, I can even create a Process for you.