Generating Single Executable jar file with all dependencies and libraries using Netbeans and Eclipse

Generating Single Jar file with all dependencies in Eclipse is easy. We just need to follow below steps :

  1. Either from the context menu or from the menu bar’s File menu, select Export.
  2. Expand the Java node and select JAR file. Click Next.
  3. In the JAR File Specification page, select the resources that you want to export in the Select the resources to export field.
  4. Select the appropriate checkbox to specify whether you want to Export generated class files and resources or Export Java source files and resources. (Note: Selected resources are exported in both cases.
  5. If there are other files or resources you want to include they must be in a an open project. Browse to their location via the directory tree on the left and ensure the file or resource is checked in the window on the right.
  6. In the Select the export destination field, either type or click Browse to select a location for the JAR file.
  7. Select or clear the Overwrite existing files without warning checkbox. If you clear this checkbox, then you will be prompted to confirm the replacement of each file that will be overwritten.
  8. Click Finish to create the JAR file immediately.
  9. Now, navigate to the location you specified for the jar. The icon you see and the behavior you get if you double click it will vary depending on how your computer is set up.
  10. You can use this article for images and more detail.

Continue reading

Salesforce Spring 15 – some highlighted features

Download PDF version of release notes from here.

1. Import Account / Contact from 16 different sources (previously generic csv was only option to import).

Import Account Contact in Salesforce - 16 sources

Import Account / Contact in Salesforce – 16 sources

2. Salesforce Analytics Query language (SAQL)
We already know about SOQL and SOSL. This is new Query language for Analytics cloud to enable ad hoc analysis of data stored in dataset. This is still in pilot.

3. Enhanced version of “Notes”

In this release, Salesforce has released new version of notes, which has many advantages over old like Create Standalone Notes, Relate same notes to multiple records, include bullet or numbered list, search only on notes, Create tasks from notes, Report on notes.

To enable Notes – Build | Customize | Notes | Settings | Enable Notes.

Salesforce Spring 15 Notes

Salesforce Spring 15 Notes [Click to enlarge]

 As you can see in image3, new Notes can relate to multiple records. Continue reading

Automate Command Line Dataloader using ANT with Dynamic arguments and SOQL query

As we know, there are multiple ways to load data inside Salesforce like using Workbench, Jitterbit, API etc… Salesforce also provides standard tool to load data into Salesforce using DataLoader. Dataloader by default supports User Interface or Command Line interface. Most of us already know that User interface based Dataloader needs manual interaction by end user. However if you want to automate data related operations, better choice would be Command Line Data Loader. Assuming you already have basic knowledge about how CLI Data loader works, I will go more advance in this article.

Automate Command Line Data Loader

Automate Command Line Data Loader

Following are basic steps for CLI Dataloader :

  1. Download and install DataLoader
  2. Generate Secret key file
  3. Generate Password on basis of Secret key generated
  4. Create “Process-conf.xml” (here is the problem)
  5. Create field mapping (sdl) file if required
  6. Execute Data loader from Command line

Continue reading

Salesforce – Drag and Drop File Uploader Component with Progress Bar – HTML5 and Pure Javascript Based

HTML5 Drag And Drop File

HTML5 based Drag And Drop File

You may find many ways to upload attachments in Salesforce using visualforce however most of them uses some Javascript libraries (means either you need to depend on static resources or add CDN in remote site settings) or they do not have progress bar or they are not drag and drop. I thought to create one simple Visualforce component which can show progress bar and have drag and drop capabilities.

Initially i gave though to use visualforce remoting however challenge was how to show progress bar and same challenge was with custom controller or extension also. So, i decided to create one simple Apex REST API to upload attachment.

Continue reading

Salesforce FAQ – Part 19

181. Lets consider your custom Object named “Training__c” has field “Trainer__c”. You have set some default value in that field. Will that default value apply to new record created by apex code ?
OR
How to make sure that record created from apex code should respect default value of fields ?
OR
Default value in field from Apex code.
Ans :

After API 20, it should automatically populate However there is known issue for same here, click here if it impacts you.
Workaround :
If Default value of field is not getting populated by Apex then we have to use “Dynamic Apex”.  Create instance of object from sObjectType like shown below:

Training__c tr= (Training__c) Training__c.sObjectType.newSObject(null, true);

//Check if Value in field "Trainer__c" is default value
System.assertEquals('Jitendra', tr.Trainer__c);

182. What is best practice to refer dynamic custom messages in Visualforce with multi-language support ?
Ans :
Using Custom Label or OutputField or InputField tag, Platform itself will take care of internationalization. However in some cases, Message needs to be dynamic at the same time it should also support muti-language. In Custom Label, we cannot save dynamic String.

Let’s assume we want to show message something like “DEVELOPERNAME is not authorized to access this page”.
Here, Developername should be dynamically changed in visualforce which supports multilanguage. For each developername, it is not feasible to create custom labels. So below workaround can be used :

Step 1 : Create a Custom Label with text “{0} is not authorized to access this page“. In every language, dynamic value should represented by {0}.

Step 2 : In Controller of Visualforce write something like this :

String developerName = 'Some DeveloperName';
String message = String.format(Label.DEVELOPERNA, new String[] { developerName });

Continue reading

Access Camera and Audio recorder of Mobile device in Visualforce and upload as chatter file

In this article we will see how to use Camera and Audio recorder of mobile device in Visualforce and upload as chatter file. It may look that it is very tricky to access device camera and audio control in Visualforce however you may be right if there were no HTML5. Thanks to HTML5 for magic.

Visualforce Camera Access - Front Page

Visualforce Camera Access – Front Page

Visualforce Camera Access - Use Camera Prompt

Visualforce Camera Access – Use Camera Prompt

Continue reading

Why to use Bower for your web developement

What is Bower
It is client side package Manager and Great tool to manage all you web dependencies like JavaScript libraries and other assets.

Bower

Bower

What can be done from Bower
Web sites are made of lots of things — frameworks, libraries, assets, utilities, and rainbows. Bower manages all these things for you.

# registered package
$ bower install jquery

# GitHub shorthand – download repository SOQLBuilder from user Jitendra on Git
$ bower install JitendraZaa/SOQLBuilder

# Git endpoint
$ bower install git://github.com/user/package.git

# URL
$ bower install http://somewebsiteURL.com/script.js

Continue reading

How to use PostgreSQL in Nodejs

I have written many articles on Node.js and AngularJs. In this article, I will demonstrate how to use PostgreSQL with Node.js and deploy on Heroku. I think you already smelled that this is one of starting article which will finally merged with Salesforce to create some cool application.

Assuming you already have some background knowledge on Node.js and Heroku, If not please visit previous articles of this blog or my Slideshare account. Using Angularjs is totally optional and you can use library like JQuery or plain JavaScript.

To connect PostgreSQL, we need “pg” module.

PostgreSQL in Node.js

PostgreSQL in Node.js

Continue reading

Dreamforce 2014 Session – create web based IDE for Salesforce

In Dreamforce 2014, I got chance to present demo of creating online IDE for Salesforce using Tooling API. I used Node.js as a language to communicate with Salesforce API on Heroku Platform.

Demo

  1. Simple Editor
  2. Editor with Ace framework

Complete source code (Github)

  1. Simple Editor
  2. Editor with Ace framework

Dont forget to share your feedback.

Below is the presentation slide I used