Thursday, March 6, 2014

How Does Apex Work?


How Does Apex Work?


All Apex runs entirely on-demand on the Force.com platform, as shown in the following  architecture diagram:





When a developer writes and saves Apex code to the platform, the platform application server first compiles the code into an abstract set of instructions that can be understood by the Apex runtime interpreter, and then saves those instructions as metadata.

When an end-user triggers the execution of Apex, perhaps by clicking a button or accessing a Visualforce page, the platform application server retrieves the compiled instructions from the metadata and sends them through the runtime interpreter before returning the result. The end-user observes no differences in execution time from standard platform requests.

Wednesday, March 5, 2014

Salesforce Custom Settings

Salesforce Custom Settings


Although Custom Setting is similar with Custom Object, but they are different and for totally different usage. Custom object used to store all data within Salesforce for any transactions, it works similar with standard object, such as: Account, Contact, Opportunity, etc and you can create custom tab for that object.

While custom setting used to store application configurations, such as: value based on each application type or user. You cannot put custom setting data into Salesforce page layout directly as custom object. But, to access custom setting data, you need to access it from: Formula fields, Validation rules, Workflow rules, Apex class, and SOAP API.

There are 2 type of custom setting: List and Hierarchy. Formula field, Validation rule and Workflow only can access Hierarchy type custom setting, while Apex and SOAP API can access both.

Sample to access hierarchy custom setting from formula field or validation rule:
{!$Setup.CustomSettingName__c.CustomFieldName__c}

From SOAP API:
Select p.Description__c, p.Id, p.Name, p.Sign_Date__c from Position__c p
this is very similar with SOQL query to custom object.


Limitation of Custom Setting:

  • Maximum total data of 10 MB, but if you have less than 10 license users, multiply 1 MB with number of users
  • 300 fields per custom setting.
  • Can’t share a custom setting record.
  • No owner assigned for each custom setting record
  • Each custom setting counts against the total number of custom objects available for your organization.


For more information, see think Salesforce documentation.

How Deploy Salesforce Profiles using Change Set?

How Deploy Salesforce Profiles using Change Set



Is it possible to deploy Profile using Change Set?

My experience in deploying Salesforce Profile using Change Set is very challenging (even using Force.com IDE). As of current Salesforce release (Winter '14), this feature is still very primitive, a few areas still not deployed properly and require manual configuration in Target instance:

  • Standard Object Layouts
  • Custom Object Layouts
  • Field-Level Security
  • Custom App Settings
  • Tab Settings
  • Record Type Settings
  • Standard Object Permissions
  • Custom Object Permissions
  • Apex Class Access
  • Visualforce Page Access

Below items will always deploy properly (overwrite target profile) when you add User Profile in 'Profile Settings For Included Components' :

  • Administrative Permissions
  • General User Permissions
  • Login Hours
  • Login IP Ranges
As profile is not Change Set Components, it will not allow you to Upload a Change Set. So, if you want to deploy just items related to 4 items above related to profiles, the workaround is to add any component to the change set, such as: custom field or others.

If you have a profile has been deleted in Target instance, and you deploy Change Set with that profile, deleted profile will be restored with all permissions before it is deleted.


For list of items in top portion above, if there is a Component Type for it, you can deploy them by adding into Component Type with Profile Settings For Included Components.


List of Component Type available in Change Set:

Account Criteria Based Sharing Rule

Account Owner Sharing Rule
Account Territory Owner Sharing Rule
Action (includes object-oriented publisher actions and global publisher actions)
Analytic Snapshot
Apex Class
Apex Sharing Reason
Apex Trigger
App
Approval Process (with some restrictions)
Assignment Rule
Auth. Provider
AutoResponse Rule
Button or Link
Call Center
Campaign Criteria Based Sharing Rule
Campaign Owner Sharing Rule
Case Criteria Based Sharing Rule
Case Owner Sharing Rule
Communities (Zones)
Compact Layout
Contact Criteria Based Sharing Rule
Contact Owner Sharing Rule
Custom Data Type
Custom Field
Custom Label
Custom Object
Custom Object Criteria Sharing Rule
Custom Object Owner Sharing Rule
Custom Report Type
Custom Setting
Dashboard
Document
Email Template
External Data Source
Escalation Rule
Field Set
Flexible Page
Flow
Folder
Group
Home Page Component
Home Page Layout
Letterhead
Language Translation
Lead Criteria Based Sharing Rule
Lead Owner Sharing Rule
List View
Opportunity Criteria Based Sharing Rule
Opportunity Owner Sharing Rule
Page Layout
Permission Set
Post Templates for Approvals in Chatter
Queue
Record Type
Remote Site
Report
Role
S-Control
Send Action
Static resource
Tab
Territory
User Criteria Based Sharing Rule
User Membership Based Sharing Rule
Validation Rule
Visualforce Component
Visualforce Page
Workflow Email Alert
Workflow Field Update
Workflow Outbound Message
Workflow Rule
Workflow Task
Workflow Time Trigger


More information from Salesforce related to this blog:


Find email template associated to which email alerts

Find email template associated to which email alerts


This blog in particular is about how to know which email template is associated to which email alerts.

Imagine if you have thousand of email templates created over years by users, how do you able to track if an email template is used in which email alerts of workflow?

Here are the steps on how to create a list view under email alerts:

  1. Click your name and click on Set Up.
  2. Under workflow and approvals click on Email Alerts
  3. On email alerts click on Create New View
  4. From the filters on the view, select Email Template Name field and type in the Email Template Name you would like to check, as your basis to filter.
  5. Click Save and you should be able to see all the email alerts associated with the email template.






More information on Salesforce on Managing Email Alerts and Creating Custom List Views



Tuesday, March 4, 2014

Write Apex Tests Using Best Practices


Write Apex Tests Using Best Practices 




Build Your First Native Android App in Salesforce

Build Your First Native Android App in Salesforce.





Intro to Salesforce Mobile SDK: Building Hybrid Apps in Salesforce Webinar

Intro to Salesforce Mobile SDK: Building Hybrid Apps Webinar



Hands-on Training: Build your First Mobile SDK App

Build your First Mobile SDK App in Salesforce.




Introduction to Developing Android Apps With the Salesforce

Introduction to Developing Android Apps With the Salesforce 





Developing Offline Mobile Apps With Salesforce Mobile SDK

Developing Offline Mobile Apps With Salesforce Mobile SDK





Create a Hybrid Mobile App With the Salesforce Mobile SDK

Create a Hybrid Mobile App With the Salesforce Mobile SDK



Creating a Record Type and Page Layout in Salesforce.com

Creating a Record Type and Page Layout in Salesforce.com?





Workflow & Approvals in Salesforce.com

Workflow & Approvals in Salesforce.com



Introduction to Salesforce.com

What is salesforce?Introduction to salesforce.




What is CRM?

What is CRM?




What is Cloud Computing?

What is Cloud Computing?




What is Salesforce CRM?

What is Salesforce CRM?



Project Management in Salesforce: How to Prioritize Projects

Project Management in Salesforce: How to Prioritize Projects in Salesforce



Hands-on Training: Set Up Collaborative Forecasts


Hands-on Training: Make the Connection - Salesforce for Outlook

Hands-on Training: Make the Connection - Salesforce for Outlook





Understanding Multitenancy and the Architecture of the Salesforce

Understanding Multitenancy and the Architecture of the Salesforce









Hands-on Training: Get Started with Service Cloud Administration

Get Started with Service Cloud Administration




Hands-on Training: Get Started with Sales Reports and Dashboards

Hands-on Training: Get Started with Sales Reports and Dashboards





Hands-on Training: Extend Reports w/ Buckets, Cross Filters & and Joined Format

Hands-on Training: Extend Reports w/ Buckets, Cross Filters &  and Joined Format








Salesforce: Notes and Attachments

Salesforce: Notes and Attachments


Notes and Attachments is not a new thing in Salesforce. I also do not see any enhancements in last few Salesforce release. But, for some users, Notes and Attachments still a nice feature and frequently used.

Here a few facts on Notes and Attachments good to remember:

  1. It is not possible to report on the Notes and Attachments related list.
  2. The Notes & Attachments can be exported directly via the API.
  3. It is possible to access your Notes & Attachments data by requesting a full data export of your organization's data. 
  4. The only way to get attachment on an Salesforce email to Attachment is to download the attachment to your local machine, then manually added as an Attachment from the local machine location.
  5. Notes and attachments marked as Private via the Private checkbox are accessible only to the person who attached them, Administrators and users with View All Data permission.
  6. You must have “Read/Write” access to parent record to be able to add Notes or Attachments to the record.
  7. You also need to have “Read/Write” access permission to parent record to be able to edit or delete Notes or Attachments.
  8. You can write Apex trigger for Notes & Attachments using Force.IDE

Special thanks to Jason Lawrence for the input of Feed Attachment, so if you attach File to Chatter Feed in an Account or Opportunity, it will show as well in Notes & Attachments as Feed Attachment.






Have a nice day!

Monday, March 3, 2014

Interview Questions Part 1

Q). What is Public cloud and Private Cloud?


Ans).
        Public Cloud: Could services are provided "as a service" over the Internet with little or no control over the underlying technology infrastructure. More than one tenant can use the same resources.


    Private Cloud: This also offers activities and functions "as a service" but is deployed over a company intranet or hosted datacenter. This is private product for a company or organization offering advance security.

    Salesforce.com: Is a public cloud as it is hosted on salesforce.com data centers and data of more than one tenant resides on same servers.


Sunday, March 2, 2014

Cannot send email from Salesforce Sandbox

Cannot send email from Salesforce Sandbox

If you just create new sandbox or refresh a sandbox Sandbox, you will not able to send email: manually, from workflow or from apex code. This is because since Spring '13 release, Salesforce has change email deliverability to System email only.

You can change the email deliverability to All email from Setup > Email Administration > Deliverability.











If system administrator have not change email deliverability, user will not see Send an Email button in Contact, Lead or Case related list, although it is has added to the object related list page layout.

From Workflow or Auto-Response Rules, email will not send out and there is no notification.
From apex code, you will found this error "Email Privileges Revoked", see this blog.

You can check Email Logs to audit all email send from and to Salesforce, email logs accessible from Setup > Logs > Email Log Files.





Saturday, March 1, 2014

Hands-on Training: Get Started with Sales Cloud Administration

Watch this video and get started with sales cloud administration




 
| ,