1

I am seeing some odd behaviour with Numeric vs Percent fields.

I have two fields, on separate objects:

  • Percentage Commission on Object A - Number(15,3)
  • Percentage Commission on Object B - Percent(3,4)

So, in Object A I am seeing values like 0.05 to represent 5% and then when these values are copied (via Apex) to Object B I am seeing the value 5.

This is all working as expected in both Packaging org and Sandbox, but as soon as deployed to Production I now get 0.5 in Object A and also 0.5 in Object B so instead of some a salesman getting 5% commission, they're only getting 0.05% (I know, poor them ;).

This is the line of Apex that performs the copy each 'line' is an instance of Object A, detail is an instance of Object B:

detail.Percent_Commission__c = (Decimal)line.get('Rep_Percentage__c');

Am I just missing something really obvious or is there something else at play? Thanks!

  • Can you share the relevant Apex code? – Adrian Larson Feb 15 '16 at 18:20
  • i've copied the relevant line, seems like its more environmental to me since its only different on Production – Phil Hawthorn Feb 15 '16 at 18:25
  • Have you verified that the types match up between environments for both fields? Which field is percent and which is number? – Adrian Larson Feb 15 '16 at 18:36
  • Yes, all same across all environments. Rep_Percentage__c is Number(15,3) Percent_Commission__c is Percent(3,4) – Phil Hawthorn Feb 15 '16 at 18:41
  • 1
    Is the Apex Class in question the same API Version in both? – Adrian Larson Feb 15 '16 at 18:44

Your Answer

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

Browse other questions tagged or ask your own question.