Friday 26 July 2019

          Cache control value control in a static resource:


Private- It specifies static resource data cached on the Salesforce server shouldn’t be shared with other users. The static resource is only stored in cache for the current user’s session.

Public specifies that the static resource data cached on the Salesforce server be shared with other users in your organization for faster load times.

https://salesforce.stackexchange.com/questions/9038/what-does-the-cache-control-value-control-in-a-static-resource

           System.ListException: List index out of bounds error

Before referring to the 0th index of list you must perform a check on whether the list is empty or not. Whenever you try to access records from list first check if its empty or not.

List <contact>contactList = [Select Id, Name from contact Limit 10];
// Before processing the list check if its empty or not
// It will go inside the loop only if the List is having values in it.
if(contactList.size() > 0) {
 // Do something with contactList [0].Name
 }
// If you try to access contactList [0] without empty check then it will obviously throw that error!!