Monday, 19 January 2015

Triggers and Order of Execution Salesforce

When you save a record with an insert, update,delete or upsert statement. Salesforce perform the following event in below order

1.     Loads the original record from the database or initializes the record for an upsert statement.
2.     Loads the new record field values from the request and overwrites the old values.
If the request came from a standard UI edit page, Salesforce runs system validation to check the record for:

    •      Compliance with layout-specific rules
    •          Required values at the layout level and field-definition level
    •          Valid field formats
    •          Maximum field length

Salesforce doesn't perform system validation in this step when the request comes from other sources, such as an Apex application or a SOAP API call.
Salesforce runs user-defined validation rules if multiline items were created, such as quote line items and opportunity line items.
3.     Executes all before triggers.
4.     Runs most system validation steps again, such as verifying that all required fields have a non-null value, and runs any user-defined validation rules. The only system validation that Salesforce doesn't run a second time (when the request comes from a standard UI edit page) is the enforcement of layout-specific rules.
5.     Executes duplicate rules. If the duplicate rule identifies the record as a duplicate and uses the block action, the record is not saved and no further steps, such as after triggers and workflow rules, are taken.
6.     Saves the record to the database, but doesn't commit yet.
7.     Executes all after triggers.
8.     Executes assignment rules.
9.     Executes auto-response rules.
10.  Executes workflow rules.
11.  If there are workflow field updates, updates the record again.
12.  If workflow field updates introduced new duplicate field values, executes duplicate rules again.
13.  If the record was updated with workflow field updates, fires before update triggers and after update triggers one more time (and only one more time), in addition to standard validations. Custom validation rules are not run again.
14.  Executes processes.
Processes are currently available through a private beta program. For information on enabling this feature in your organization, contact Salesforce.
If there are workflow flow triggers, executes the flows.
Flow trigger workflow actions, formerly available in a pilot program, have been superseded by the Process Builder. Organizations that are using flow trigger workflow actions may continue to create and edit them, but flow trigger workflow actions aren’t available for new organizations. For information on enabling the Process Builder (beta) in your organization, contact Salesforce.
15.  Executes escalation rules.
16.  Executes entitlement rules.
17.  If the record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record. Parent record goes through save procedure.
18.  If the parent record is updated, and a grandparent record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the grandparent record. Grandparent record goes through save procedure.
19.  Executes Criteria Based Sharing evaluation.
20.  Commits all DML operations to the database.
21.  Executes post-commit logic, such as sending email.

Friday, 2 January 2015

Salesforce.com Spring ’15 Release Notes :- Some Features I like

1) Indexed Column Added to Lists of Fields in Setup

Listings of fields in Setup include a new Indexed column that indicates when a field is indexed in the database
The new column is available for standard and custom objects and indicates indexing for standard and custom fields.

2) Get Faster and More Relevant Search Results (Generally Available)

In the Winter ’15 release, Salesforce Knowledge article search was updated with the new search infrastructure. In Spring ’15, we’re expanding this search infrastructure to all search utilities, including global search, sidebar search, and advanced search. This expanded enhancement was previously available only through a pilot program.
Faster indexing
Improved alphanumeric search

3) Import Accounts and Contacts with Ease

Available to new and trial organizations and coming soon to all other organizations, choose from sixteen popular data sources to quickly and easily get your accounts and contacts into Salesforce


4) Middle Name and Suffix Fields for Person Objects (Generally Available)

Better represent the name of a person associated with a record by adding Middle Name and Suffix fields in person objects. Using these fields also helps to avoid confusion when two records have the same first and last names

The Middle Name and Suffix fields are available for the following person objects: Contact, Lead, Person Account, and User. You need to do a few things before you can use them.

  1. Contact Salesforce Customer Support to enable the new fields.
  2. Click Setup | Customize | User Interface.
  3. In the Name Settings section, select Enable Middle Names for Person Names and Enable Name Suffixes for Person Names.
  4. Click Save.

5) More Streamlined Look for the Rich Text Editor

The Rich Text Editor, also known as the HTML Editor, that’s available in most rich text area fields has a new look, better performance, bug fixes, improved styling for pasted data, improved handling for pasted images, and increased compatibility with newer browsers. The updated editor is also available in rich text area custom fields on records and more


6)Administration Settings Moved from Setup to Community Management

Community Management is now a one-stop shop for setting up and managing your community. Setup consolidation makes it easier forcommunity administrators and managers to do their jobs from one location.

From Setup, click Customize | Communities | All Communities, then click Manage next to the community name

7) Prevent Spammers from Creating Cases

The reCAPTCHA widget requires guest users to complete a text field successfully before they can create a case. Setting up the widget on the Case Creation page elements protects your community from spam case submissions.

8) Open CTI

Open CTI helps partners integrate Salesforce with Computer-Telephony Integration (CTI) systems without installing adapter programs on call center users’ machines.
Several new and updated methods are available to help developers and advanced administrators customize SoftPhones for users. For more information, see Open CTI API.

9) Emoticons Added in the Feed

Now your users can add expressions like a smiley face to their posts and comments by typing a character combination

We enabled emoticons by default. However, if you want to disable emoticons, navigate to Setup and click Customize |Chatter | Settings. In the Emoticons in Feed section, deselect Allow Emoticons.

10) Deploy Your Components in Less Time (Generally Available)


You can now deploy components to production by skipping the execution of all Apex tests for components that have been validated within the last four days. With Quick Deploy, you no longer have to wait for all tests to run for your deployment to complete in production, and your deployment will likely finish in less than 30 minutes.
As part of a deployment, all Apex tests are run in production. If the production organization contains many Apex tests, the execution of all tests can be time-consuming and can delay your deployment. To reduce deployment time to production, you can perform a quick deployment by skipping the execution of all tests. Quick deployments are available for change sets and Metadata API components when the following requirements are met.
  • The components have been validated successfully for the target environment within the last four days (96 hours).
  • As part of the validation, all Apex tests in the target organization have passed.
  • The overall code coverage in the organization is at least 75%, and Apex triggers have some coverage.

11) Create or Edit Records Owned by Inactive Users

Previously, only administrators were able to edit accounts, opportunities, and custom object records that are owned by inactive users. With Spring ’15, administrators and all users with the create or edit permission can create or edit accounts, opportunities, and custom object records that are owned by inactive users. For example, you can create an account and assign an inactive user as the record owner. Or you can edit the Account Name field on an opportunity record that is owned by an inactive user to change its parent account.


12)Availability of Compound Fields in Formula Functions Changed

You could previously use compound fields in all formula expressions, but unhandled exceptions would often result. Compound fields have been enabled in the ISNULLISBLANK, and ISCHANGED functions and have been blocked in several other functions so that you won’t encounter these errors.
The following have been blocked from using compound fields.
  • BLANKVALUE
  • CASE
  • NULLVALUE
  • PRIORVALUE
  • The comparison and equality operators: = and == (equal), <> and != (not equal), < (less than), > (greater than), <= (less than or equal), >= (greater than or equal), && (AND), and || (OR)

13)Standard Address Fields Show Google Maps


Records with standard address fields now display a Google Maps image of the address. This saves users time by letting them see where their contacts or accounts are located, instead of having to locate addresses in a separate browser tab.
On a record, go to the detail page to see the Google Maps image on the address field. To generate a map image, an address must include the street and city fields and either the state, postal code, or the country. If an address field is missing any of the required information, a map won’t display

The map image on the address is static, but clicking the map image opens Google Maps in a new browser tab.
Maps on standard address fields are enabled by default. To disable maps for your organization, from Setup in the fullSalesforce site, click Customize | Maps and Locations | Settings and uncheck Enable Maps and Location Services.

Please check below link for more update :-

Thanks,
Amit Chaudhary

Quick Deployment :- Features i like most

You can now deploy components to production by skipping the execution of all Apex tests for components that have been validated within the last four days. With Quick Deploy, you no longer have to wait for all tests to run for your deployment to complete in production, and your deployment will likely finish in less than 30 minutes.
As part of a deployment, all Apex tests are run in production. If the production organization contains many Apex tests, the execution of all tests can be time-consuming and can delay your deployment. To reduce deployment time to production, you can perform a quick deployment by skipping the execution of all tests. Quick deployments are available for change sets and Metadata API components when the following requirements are met.
  • The components have been validated successfully for the target environment within the last four days (96 hours).
  • As part of the validation, all Apex tests in the target organization have passed.
  • The overall code coverage in the organization is at least 75%, and Apex triggers have some coverage.
A validation is a deployment that’s used only to check the results of deploying components and doesn’t save any components in the organization. A validation enables you to view the success or failure messages that you would receive with an actual deployment. You can validate change sets or metadata components through the API or the Force.com Migration Tool.

Performing a Quick Deployment through the User Interface or the API

To perform a quick deployment, first run a validation-only deployment with Apex test execution on the set of components that you need to deploy. If your validation succeeds and qualifies for a quick deployment, you can start a quick deployment.

You can quick-deploy validated change sets and Metadata API components in the user interface. In the Deployment Status page, deploy a recent validation by clicking Quick Deploy next to your validation or on the validation’s detail page. This button appears only for qualifying validations.

you can start a quick deployment through the Metadata API by calling deployRecentValidation() and passing it the validation ID. Use this API call to deploy Metadata API components. This call doesn’t apply to change sets.

Thursday, 1 January 2015

New Relationship Data type (External Object and Data source)



External objects are similar to custom objects, except that they map to data located outside Salesforce. Each external object relies on an external data source definition to connect with the data outside Salesforce. Each external object definition maps to a table that contains the data, and the object fields map to accessible table columns. The data in the external table can be searched and referenced in Salesforce using custom tabs and federated search.


1) Each organization can have up to 100 external objects.


External Lookup Relationship could now be setup between external objects and Salesforce object.
External Object - They are same as custom objects but used to map to data located outside Salesforce. External object take data from External source and External source obviously has its own DB. 

To create external object : From Setup, click Develop | External Objects.
To create external Data source : Develop | External data source

How to add Image on apex Command Button ()


To add image in button we need to use below style tag in apex command button tab:-

<apex:commandButton action="{!Export}" value="Export" style="background-image:url({!URLFOR($Resource.SiteSamples,'img/warning.png')});height:25px;width:100px;border-width:0px;background-repeat:no-repeat;cursor:pointer;"/>

                           
Thanks,
Amit Chaudhary

Translation Workbench - Salesforce ( Multilingual picklist values )

Translation Workbench | Salesforce  

ü  Enable the translation workbench with the languages you require.
ü  Create Translations for objects and fields

Enable the translation work bench
NavigationSetup  > Translation workbench > Translation settings


Note: In a Developer organization with a managed package containing translations, once the Translation Workbench is enabled, it can't be disabled.
Note: The “Manage Translation” permission is enabled by default in the System Administrator profile.
To disable the Translation Workbench, from Setup, Translation Workbench -> Translation Settings -> Disable

Adding Translated Languages and Translators

To add or edit translated languages and translators:

      1. From Setup, click Translation Workbench -> Translation Settings.
      2. Click Add to activate a new language or Edit to change an existing supported language.
      3. If adding a new language, choose a language.
      4. To make the entered translations available to your users - select Active. Users can change their           personal language anytime whether or not it's active in the Translation Workbench. Selecting              Active makes the translations available to the users in that language.
        Tip: We recommend you don't make a language active until the translators have translated all values.
      5. To assign translators for this language, select them from the Available List and click Add. If               you don’t    see the member you want to add, enter keywords in the search box and click Find.
      6. Click Save



 



Entering Translations and Overrides
  1. Click Translation Workbench -> Translate to translate customizations made to your Salesforce organization or Translation Workbench -> Override to override translations from managed packages.
  2. If you are overriding translations in managed packages, select the Package you are overriding.
  3. Select the Language you're translating into.
  4. Select a Setup Component. Click the pull-down menu to select from the list of translatable       customizations. See Translatable Customizations for a complete list of possible customizations.
  5. If necessary select an object and aspect. For example, workflow tasks have an object (Account, Contact, etc.) and aspect (Subject or Comment).
  6. Double click in the translation column to enter new values. You can press TAB to advance to the next editable field or SHIFT-TAB to go to the previous editable field.
  7. Click Save




How to see the Translation

  NavigationMy settings > Personal > Language & Time Zone
  Change the language in the below screen and verify the localized text which is entered


  
Best Practices for the Translation Workbench

To make the Translation Workbench most effective, administrators should:
  • Let translators know which languages they are responsible for translating.
  • Notify all translators when new translated components are added to your organization.
  • Advise users when customizing reports or list views to use filter criteria values in their personal language.

However, if they use the Starts With or Contains operators, advise them to choose the language of
the filter criteria values they entered.

Localize and Customize Labels and Messages of Visual Force Pages

The following steps are required for localize the labels
  1. Enable the translation workbench with the languages you require.
  2. Create labels for all the localizable text on the page.
  3. Replace the page text with the labels.
  4. Add a translation for each label.
  5. Change your profile language to test

Translate and Customize Labels

Navigation: Setup > Create > Custom Labels

Click on new custom label


Accessing custom label in the visual force page

<apex:page controller="TranslationWorkbenchDemoController">
  <h1>{!$Label.Welcome}</h1>
</apex:page>

Accessing Custom label in the apex classes

  ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, Label.Welcome ));


Thanks,
Amit Chaudhary