0

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.

1 Answer 1

3

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

if (acc.size__c <= Integer.valueOf(system.label.Com_size))
4
  • That was an easy one. I knew you would be on that one. Must be fast with you guys haha.
    – brovasi
    Commented Jan 18, 2017 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
    Commented Jan 18, 2017 at 4:24
  • sorry for late reply.but its working perfect.Thanks
    – dem
    Commented Jan 18, 2017 at 14:19
  • You welcome @dem, feel free to mark it as a Answer for other blogger.
    – brovasi
    Commented Jan 18, 2017 at 23:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .