Skip to main content

Posts

Showing posts with the label Force.com IDE

Time to Migrate from Salesforce Force.com IDE to VS Code

Image Credit: Visualstudio marketplace Why? In case you don’t know Salesforce is phasing out Force.com IDE (planned for June 2018) to promote newer IDE choices. There are already many IDEs out there to take Eclipse based Force.com IDE’s place. However, Salesforce is officially promoting Microsoft Visual Studio Code (aka VS Code) as official IDE. What is VS Code? VS Code is a platform-independent, light-weight and keyboard focused IDE for Salesforce (sorry for folks who loved menus and GUI). VS Code does have visual menus and options, however, using keyboard shortcuts is just do damn fast. There is surely some learning curve involved. But, once you get rolling, you would hate using mouse, as it takes a lot of work to raise your hand, move mouse, point and click and navigate, when you can just press “Ctrl + /” to comment current code selection. VS Code features Lightweight – In case  you have worked a lot with Eclipse, you might have noticed that it was a memory hog...

Sneak Peek: What is Visualforce Viewstate? and how to keep it lean

Note: The main content for this blog post was shared by my friend and colleague Shriram Kabra. There are loads of blogs and articles around managing viewstate in Visualforce pages. As you would know, viewstate is primarily a serialized form of controller state between postbacks. It is very helpful to retain controller's state between client's browser and server. How viewstate works? Every time user opens a visualforce page, Salesforce executes related controller(s). As per controller logic, data is retrieved/ created within memory. This data can also be considered as controller state. If you monitor the lifecycle of Salesforce object (object of controller), it ends as soon as it responds to browser and loses its state. Technically, all subsequent requests for it are fresh page loads. In order for visualforce to retain this state between all postbacks, it needs to store this state somewhere. This is where Viewstate comes handy. While rendering visualforce page,...

Sneak Peek: Visualforce with Javascript Promises

While working with Visualforce pages along with javascript remoting functionalities, we often create a lot of callback methods. On top of it, multiple invocations in a chained approach is more chaotic, often hardcoded and leaves code quite unreadable.   Following is an example code while using Javascript remoting within Visualforce page:-   function invoke_remoteService1 (){ console .log ( ' Invoking remote service 1' ); Visualforce.remoting.Manager.invokeAction( '{!$RemoteAction.testWebServiceController.remoteService1}' , remoteService1_ResponseHandler); } function remoteService1_ResponseHandler (response, event){ console .log ( ' Response from remote service 1 = ' + response); if (response ! = null ){ console .log ( ' Invoking remote service 2' ); Visualforce.remoting.Manager.invokeAction( '{!$RemoteAction.testWebServiceController.remoteService2}...

Quick Tips: Custom security settings (When to use Salesforce Custom Permissions?)

How often did each one of us get into a situation where we have to create custom security rules? For e.g. Call center agents should not be able to give credits. Only Supervisors or Finance team can give credits Only Finance and Account Manager can generate invoice. And the most trivial way to achieve it is something like if(profileName == 'Supervisor || profileName == 'Finance'){      // business logic to give credits } else{     //throw error message } Now, one of the best ways to handle this is by using "Custom Permissions". It allows you to leverage Salesforce security infrastructure and loosely bind that to your custom logic. This helps in making your code scalable and robust. You'll learn that below. What are Custom Permissions? Custom Permissions was made GA in Summer '15 (ver 34.0). It is a unique way of creating a custom permission which is required/ to be used by your custom logic. For e.g. in above example, if we create ...

Quick Tips: Merge fields in Visualforce

As most of my colleagues know me, I have always struggled to remember fieldnames, action names and have hard time copying names of fields from Object detail page and put them onto a Visualforce page, while creating merge fields. I just wanted to share a small tip for all those who share my "struggle" and want to have an easy way to get around that. If you are an eclipse user, Force.com plugin comes up with a very handy tool. Following are the tips to use it:- Open visualforce page in eclipse Open right click menu Click on Force.com> Insert Merge Field Voilla, you have all the objects listed in left hand list and on selecting an object, their fields gets populated in right hand list (as shown below) Additionally, you can also lookup standard actions available by selecting "$Actions" in the left hand list and it would display a list of all actions available (as per screenshot below):- Hope this helps your visualforce development and don't m...