3 November 2014

Tracking First Response on Case Record

Tracking First Response on Case based on Case Comment 

This is common requirement to track the First Response time on Case based on the first Case comment.

Here is the simple Solution:


1. Create a custom field of type Date/time called first response time on Case object.

2. Create a workflow rule on "Case comment" object"  with criteria where first response time is NULL.

Screenshot:


3. Create a Workflow Field update on this rule to update the first response to NOW().

Screenshot:

4. Finally Activate the Workflow Rule.

Hope this will help you.

Salesforce:View state Best Practices

View state Best Practices

Most of us get error regarding "Maximum view state size limit (135KB) exceeded."

This post talks about the Best Practices to avoid this error& Optimizing size of View State:

1. Minimize number of form on a page: Assume a page contains two forms - form 1 and form 2. Irrespective of which form the user submits and causes a post back, the view state for the page needs to get transferred. To support this, each form on your page will have its own copy of view state.

2. Declare variable as transient: An instance variable declared as transient is not saved and is not transmitted as part of the view state. If a certain field is needed only for the duration of the page request and does not need to be part of the view state, declare it as transient.

3. Refine your SOQL to only retrieve the data needed by the page: Only retrieve (and store) the fields you need and also filter the data to only retrieve data needed by the page.

4. Refactor your pages to make its view stateless: Instead of using apex:commandLink or apex:commandButton components (which needs to be inside a apex:form component) to invoke an action, use an apex:outputLink or other non action method instead and implement the action through an apex:page action attribute - where it makes sense.

5. Use custom objects or custom settings to store large quantities of read only data

Hope this will help you!