0

I have a controller extension for a VF page that runs a query that could possibly over load the view state, I don't want to optimize it but instead catch the exception and display a custom message. Is this possible ? If not, on the VF page, can I not detect that the view state size limit has been surpassed 'onLoad' or something similar ? Maybe with javascript ?

6
  • 1
    Have you looked into this?salesforce.stackexchange.com/questions/61410/… Aug 1, 2018 at 16:13
  • 1
    I don't think there is a way to calculate view state! One other way would be if you are displaying a list of records, like mohit was speaking in the other thread you could look for other limits(like 10k rows) and do some custom error handling Aug 1, 2018 at 16:34
  • 1
    If your use case is very specific it will be easy for community members to suggest you a more precise solution! Aug 1, 2018 at 16:47
  • 1
    Most governor limits exceptions can't be caught or handled. In some cases you can instrument to check if you're getting close by looking at (e.g.) how many SOQL queries have been executed in the current transaction, but that doesn't really apply in the same way to view state.
    – David Reed
    Aug 1, 2018 at 17:14
  • 1
    Well that's inconvenient
    – MadMax
    Aug 1, 2018 at 18:06

0

You must log in to answer this question.

Browse other questions tagged .