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
Somasundaram SubramanianSomasundaram Subramanian 

currency field 0 value

i have a field its from financial package and currency type field ffps_zuora__PrebillConsumed__c value is  USD 0.00
the apex class code as per the value it should not assign prebill usage but its processing and the value consider as greater than 0 any idea?
 if (bei.ffps_zuora__PrebillConsumed__c > 0) {
        prebillUsage = setPrebillUsageData(bei, subName);
      }
Emily CoatesEmily Coates
Ensure that the ffps_zuora__PrebillConsumed__c field is of a numeric type (such as a decimal or number field).
Verify that the field is populated with the correct value in the correct format (e.g., USD 0.00).
Consider using the appropriate field type and perform the comparison based on the numeric value, rather than the entire field value. For example:  By explicitly converting the field value to a decimal, you can ensure a proper numeric comparison is made.
If the issue persists, it might be helpful to review the full context of the code and consult with a developer familiar with the specific implementation and data model to identify any other factors that could be causing this unexpected behavior.   if (Decimal.valueOf(bei.ffps_zuora__PrebillConsumed__c) > 0) {
  prebillUsage = setPrebillUsageData(bei, subName);
}  https://www.upsers.app/
 
Somasundaram SubramanianSomasundaram Subramanian
@emily
as the field is from financial package i cant change field type now the type is currency, if i compare currency  if (bei.ffps_zuora__PrebillConsumed__c > 0) will it work as expected, if i use as suggested Decimal.valueOf(bei.ffps_zuora__PrebillConsumed__c) > 0) will it work? please suggest