Tuesday, February 14, 2017

How to avoid double clicking of apex:commandButton?

Below  code can be used to avoid double clicking of apex:commandButton.

<apex:pageBlockButtons location="bottom">
<apex:actionStatus id="saveStatus">
<apex:facet name="stop">
<apex:commandButton value="Next Step" action="{!newCase}"
status="saveStatus" reRender="thefrm" />
</apex:facet>
<apex:facet name="start">
<apex:commandButton value="Saving" disabled="true" />
</apex:facet>
</apex:actionStatus>

</apex:pageBlockButtons>

What field type can be used in the WHERE clause to improve SOQL query performance in Salesforce?

The following fields are indexed by default:

1. Primary keys (Id, Name and Owner fields).
2. Foreign keys (Lookup or Master-Detail relationship fields).
3. Custom fields which are marked as External ID or Unique.
4. Audit dates (such as SystemModStamp).

How to query data which was modified in specific time limit in Salesforce?


Below is the SOQL to query data which was modified between 1 PM and 5 PM.

Sample SOQL:

SELECT Id, LastModifiedDate FROM Account WHERE LastModifiedDate = TODAY AND HOUR_IN_DAY(LastModifiedDate) >= 13 AND HOUR_IN_DAY(LastModifiedDate) < 17

How to get records which are modified in last 7 days in Salesforce?

Check the below SOQL to get records which are modified in last 7 days.

Sample SOQL:

SELECT Name, Id, LastModifiedDate FROM Account WHERE LastModifiedDate = LAST_N_DAYS:7

What is granular locking in Salesforce?

By default, the Force.com platform locks the entire group membership table to protect data integrity when Salesforce makes changes to roles and groups. This locking makes it impossible to process group changes in multiple threads to increase throughput on updates. When the granular locking feature is enabled, the system employs additional logic to allow multiple updates to proceed simultaneously if there is no hierarchical or other relationship between the roles or groups involved in the updates.

Below links provide more details on this.

https://resources.docs.salesforce.com/sfdc/pdf/draes.pdf

How to check object level security within a Visualforce page in Salesforce?

{!$ObjectType.Account.Accessible} is used to check object level security within a Visualforce page in Salesforce

Visualforce Code:


<apex:page>
    {!$ObjectType. Account.Accessible} 
</apex:page>