This error is driving me crasy
arithmetic expression must use numeric argument
obj.Without_credit_time_off_amount__c =( (User.Salary__c)/30)*obj.Days__c;
Without_credit_time_off_amount__c currency type
Days__c formula field, number type
Salary__c is a currency type
I've tried to cast the salary__c
value but in vain
Best Answer
I think zdropic has identified the problem. With no other variables involved:
is an
SObjectField
token and can't be used in an arithmetic expression. (Its purpose is to provide a compile-time checked token that represents a field of anSObject
; it can be used withSObject.get
andSObject.put
and in describe calls.) If you have a variable calledUser
(oruser
given the Apex compiler's case insensitivity) in scope, that would normally have precedence, but it is clearer to not user variable names that are identical to object type names.There is no global
User
object, there is only a globalUserInfo
object. So I would expect code looking like this to work here: