I have one formula field(size__c) datatype Number . I am checking in trigger if (acc.size__c<=system.label.Com_size) Here my Custom Label is Com_size and Value is 1000 in custom label. But I am getting below error

Comparison arguments must be compatible types: Decimal, String

Pleas suggest.How can I check if condition with custom Label.


Label are always String type. You need to cast your Label to a Integer.

if (acc.size__c <= Integer.valueOf(system.label.Com_size))
  • That was an easy one. I knew you would be on that one. Must be fast with you guys haha. Jan 18 '17 at 4:18
  • I was just wandering by, really. I like to get in a few late night answers. Glad to see I'm not the only one!
    – sfdcfox
    Jan 18 '17 at 4:24
  • sorry for late reply.but its working perfect.Thanks
    – dem
    Jan 18 '17 at 14:19
  • You welcome @dem, feel free to mark it as a Answer for other blogger. Jan 18 '17 at 23:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.