Salesforce Lightning Connect

Lightning Connect is a framework that enables you to access and use external data stored outside Salesforce, such as data in an enterprise resource planning (ERP) system. Copying the external data into your organization can be redundant and inefficient, especially if the data is constantly changing. You can instead connect to the external data source and access just the data you need when you need it, via Web service callouts.

Note: "You can currently use Lightning Connect to read external data, but not to create or update it."

External Objects vs. Custom Objects:

External objects share much of the same functionality as custom objects. For example, you can:

  • Access external objects via list views, detail pages, record feeds, custom tabs, and page layouts.
  • Define relationships between external objects and standard or custom objects to integrate data from different sources.
  • Enable Chatter feeds on external object pages for collaboration. 
Here is a quick comparison of the features supported in external objects and custom objects:

FeatureCustom ObjectsExternal Objects
Data stored in SalesforceYesNo
ReadYesYes
WriteYesNot Yet
Tabs, LayoutsYesYes
VisualforceYesYes
Field-level SecurityYesYes
SharingYesNo
REST and SOAP APIYesYes
SOQLYesYes (limited)
Search and SOSLYesYes (pass-through)
Formula FieldsYesNot Yet
Workflow, TriggersYesNot Yet
Reports and AnalyticsYesNot Yet
ChatterYesYes (no field tracking)
Types of External Connections:

To connect to an external data source and create external objects for it, Lightning Connect uses a specially designed adapter. There are currently three types of adapters.
  • OData 2.0 adapter—This lets you create external objects for data exposed by any OData 2.0 producer on the Internet. OData (Open Data Protocol) is a modern, REST-based protocol for integrating data. Vendors such as SAP and Microsoft have already implemented OData support, so products such as NetWeaver and SharePoint are directly accessible. Integration products from Salesforce partners extend the reach of Lightning Connect to a much wider range of back-office systems.
  • Salesforce adapter (pilot only)—This lets you create external objects for data from other Salesforce organizations. It uses the standard Salesforce APIs and directly connects to the remote organization without the need of any intermediary Web service, as is the case with OData.
  • Apex adapter (pilot only)—This is an SDK you can use to write your own adapters. It provides additional flexibility in case the OData or Salesforce adapters aren’t suitable for your needs.


Custom labels in javascript

We can use '{!$Label.Label_Name}' in JS function if this funtion is written on Visual force to access labels.

But Its tricky, If we need to access labels in JS file which is saved in static resource:
There are two way to do the same requiremnt:

1. Pass label as a parameter or pass-through attributes to JS function.

2. JavaScript bridging component:

2.a) loads before your script, like so:
<script>
    window.$Label = window.$Label || {};
    $Label.MyError = '{!JSENCODE($Label.MyError)}';
    $Label.MyPrompt = '{!JSENCODE($Label.MyPrompt)}';
    $Label.MyMessage = '{!JSENCODE($Label.MyMessage)}';
</script>
2.b) Now in your javascript (in a static resource) use the variables just as 
if they were VF without {!}
function errorHandler() {
    console.log($Label.MyError);
    alert($Label.MyMessage);
}

Conditional IF statements in an salesforce email template

Hi all SF guys,
Yes this is possible to have conditional IF statements in an email template.

Today I faced some issues when I was using IF statements in "HTML Email Template".

So, I found that some time its not works when you are using "HTML Email Template"  because of metadata issue.

Issue:
If you are using IF statements in HTML email template, some time its metadat in backend add some formating html and css inside of IF statements, Thats why its not working.

Solution:
Edit the email template matadata and remove all html and css which is inside your IF statement:

Note: Please use eclipse IDE or sublime text to edit email template.

Ex:
IF statements in an email template not works when email template metadata like as:
<div style="color: rgb(0, 0, 0); font-family: arial; font-size: 12pt;">
{!IF(Lead.vpUID__c&nbsp;=&nbsp;""<span style="font-size: 12pt;">,&nbsp;</span>"<span style="font-size: 12pt;">No"</span><span style="font-size: 12pt;">,&nbsp;</span></div><div style="color: rgb(0, 0, 0); font-family: arial; font-size: 12pt;"><span style="font-size: 12pt;">"Yes</span><span style="font-size: 12pt;">"</span><span style="font-size: 12pt;">)}</span></div>

To make it worable please remove all strange html inside from IF statement like as:
<div style="color: rgb(0, 0, 0); font-family: arial; font-size: 12pt;">
{!IF(Lead.vpUID__c = "", "No", "Yes)}
</div>

After removing all these strange and useless html, Save it.
Now this will work for you :)