For example we're using validation methods to verify customer address. Since this is a paid 3rd party service used by our client, if client missed paying for the service, data validation would fail and it's not nice to show a message to user with this reason though. In such scenario, If client comes back to us asking why it's failing, in order to get this without editing code, I hope this is a good way of doing it.

  • I think it would be acceptable to show a message like "Subscription to XYZ has expired, please contact your Administrator". I would rather show that then just fail without the appropriate reason or the users could get frustrated and keep trying – Eric Dec 5 '16 at 1:58
  • @Eric Thanks, But The site is public, and the users won't be internal. Therefore It's not nice to show a message like that. – Pasan Eeriyagama Dec 5 '16 at 2:25
  • 1
    yea, that changes this knowing that information – Eric Dec 5 '16 at 2:26

Setting just system.debug won't help you much since in orgs where your package is installed might have lot of other codes that might lead to logs truncation and your debug statements getting lost.

The better solutions are:

  1. Use a custom object to log all these errors that you can query and report on .

  2. If you are worried about storage limits then prefer setting an outbound emails on failure so that this is identified

  • 2
    You can also have a custom setting to enable/disable logging if you worry about the storage. – Lance Shi Dec 5 '16 at 3:35
  • Ah very valid point – Mohith Shrivastava Dec 5 '16 at 4:00
  • 3
    Also, managed package debug log tend to not appear in subscriber orgs without additional configuration from technical support, so this is definitely a better idea. – sfdcfox Dec 5 '16 at 6:20

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.