Posts

Modern JavaScript

Originally named as “LiveScript” but later launched as Javascript, owing to the popularity of the technology at that time, it has become one of the most popular programming languages. Java has been evolving over the last two decades. However, until 2015, Javascript did not have too many enhancements. The JavaScript version most developers are familiar with - ES5) - was published in 2009. Over the last few years, JavaScript has evolved rapidly and the version that we are using has become an old-school version (most of the developers call it “The Dark Ages” of the JS!). So let’s get up to the speed quickly and learn some cool new features of ECMAScript 2015+ also popularly known as ES6+. let In old-school, we were using ‘var’ to declare a variable. That has a huge loophole in the architecture and it’s behaviour. Sometimes it becomes a bottleneck for the developers because ‘var’ does not support block scope. To understand the block scope, see the following piece of script: var x = true; …

Incremental/delta data export using command line data loader

A few months back, we got a requirement for hourly incremental/delta export of data from Salesforce. There was a restriction that we didn't want to purchase any other licensed ETL tool, so we decided to use the command line data loader using that export can be scheduled also.

Command line data loader requires SOQL to export the data, so to export the data hourly we scheduled the process using windows scheduler for every hour, but the main challenge here was to write a dynamic SOQL that would apply a filter to extract the records for those created date is greater than last 1 hour. Salesforce does not provide any SOQL datetime literal like LAST_1_Hour or LAST_N_HOUR.

There are 2 methods to accomplish the requirement. First is using powershell script and the second is using SOQL itself.

Method 1 - PowerShell Script

In command line data loader, process-conf.xml contains the SOQL, so in case of an hourly incremental data extract SOQL will be like

SELECT Id, Name FROM Contact WHERE Creat…

Visualforce header and sidebar do not appear on IE11 (or lower version of IE) even when enabled

Image
Recently, we rolled out lightning experience for a Salesforce org and encountered an issue in classic experience for IE11 or lower version of IE.

IE11 does not support lightning experience by default. To enable lightning experience in IE11 following is the setting in "Setup >> Session Settings" that needs to be enabled:


As clearly explained in the above snapshot, Salesforce does not recommend this setting to be enabled, so we decided not to enable the lightning experience for IE11.

Now when users login to Salesforce in IE11, they can access only classic experience. So the issue is, when they open any VF page in IE11, header and sidebar are not visible even when showHeader and sidebar are set to true.

As per Salesforce documentation this is because, when customer switches to lightning, the flag UserPreferencesLightningExperiencePreferred is updated for the affected user.
And if the setting "Extended use of IE11 with Lightning Experience" is unchecked, IE11 ca…

Email Alert to Parent object's email field without apex

Image
Workflow! When you hear this term, a fantastic way to automate many business processes comes to your mind. Using workflows in Salesforce, you can do many things and this needs only a few clicks.

You can perform various actions using worklow like updating a field, creating tasks, sending outbound messages and email alerts.

A few years back, we got a requirement in a project where an email notification needs to be sent to opportunity owner and owner's manager if the opportunity stage turns to "Closed Won". So the requirement was simple, we just created a workflow rule with the specified criteria and created a workflow action to send the email alert. wait, wait, wait!! It was looking simple but while adding recipients to the email alert, we got stuck. There is a limitation associated with workflow email alert, we can add email fields as recipients if those are on the object for which we are creating workflow. In our scenario we needed to send email alert to the owner's ma…

Salesforce Voice Assistant

Image

Upload a File as Large as 2GB in Salesforce Using a Visualforce Page

Image
 Listed in Top 20 Salesforce Articles of 2016  by Rainforce (WalkMe)  http://rainforce.walkme.com/nectar-salesforce-gods-top-20-salesforce-articles-2016/

Recently, we got a requirement in a project to upload a file into Salesforce that could be as large as 2GB, using a Visualforce page. We created a Visualforce page and used the apex:inputFile component, but received an error upon upload because apex:inputFile has a limitation. The largest file size users can upload with Visualforce is 10MB. This posed a big limitation for the requirement. We used a different approach to meet this requirement. This is a tricky problem to solve, and needs some jQuery stuff. We decided to use the chatter:feed component in a Visualforce page. This component embeds Chatter in the Visualforce page, and allows users to upload files as large as 2GB as Chatter feed in Salesforce. It’s just as pictured below when we upload a file using this component:













As for keeping track of the files uploaded, we created a custom …