Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Salesforce Certified Platform Developer II (Plat-Dev-301) Exam - Topic 2 Question 126 Discussion

Actual exam question for Salesforce's Salesforce Certified Platform Developer II (Plat-Dev-301) exam
Question #: 126
Topic #: 2
[All Salesforce Certified Platform Developer II (Plat-Dev-301) Questions]

A developer created and tested a Visualforce page in their developer sandbox, but now receives reports that user encounter view state errors when using it in production.

What should the developer ensure to correct these errors?

Show Suggested Answer Hide Answer
Suggested Answer: C

The view state in Visualforce represents the state of the page - including the components, field values, and controller state. This error usually occurs when the page's view state becomes too large. To resolve this issue:

C . Ensure variables are marked as transient: The transient keyword in Apex can be used to declare instance variables that should not be part of the view state and therefore not be saved. This is especially useful for large data that does not need to be maintained across postbacks.

Marking properties as private (Option B) or ensuring queries do not exceed governor limits (Option A) might be best practices, but they do not directly impact the view state size. Ensuring profiles have access to the Visualforce page (Option D) is a matter of visibility and access, not related to view state errors.


Salesforce Developer Documentation on View State: Visualforce View State

Contribute your Thoughts:

0/2000 characters
Leonora
22 days ago
I think D) is super important too, gotta check access.
upvoted 0 times
...
Lennie
27 days ago
A) is definitely a must! Can't exceed those limits.
upvoted 0 times
...
Afton
2 months ago
I’m a bit confused about the private properties part; I thought they were more about encapsulation than view state problems.
upvoted 0 times
...
Cortney
2 months ago
I practiced a question similar to this, and I feel like ensuring profiles have access is crucial, but it might not fix the view state errors directly.
upvoted 0 times
...
Alberta
2 months ago
I think marking variables as transient could help with view state issues, but I can't recall if that's always necessary.
upvoted 0 times
...
Lorrine
2 months ago
I remember something about governor limits being a common issue, but I'm not sure if that's the main cause here.
upvoted 0 times
...

Save Cancel