Tuesday, August 30, 2011

Salesforce Long Text Area and Formulas

If you try to create a formula on a "Long Text Area" field, salesforce does not support this.

One workaround is to create a new field and another workflow to perform a "field update" on this:
Step 1) Create a new field with data type of "Text Area (Long)"

Step 2) Create a workflow with the following settings:

Evaluation Criteria -> select "Every time a record is created or edited"
Rule Criteria -> select "Formula evaluates to true" and type "true"

Step 3) Select "Add Workflow Action" -> "New Field Update"

Step 4) Select the newly created field as the "Field To Update" and select "Use a formula to set the new value" under "Specify New Field Value"

Step 5) You can now enter in a formula that reference other "Long Text Area" fields.  The results will be posted to the new field of type "Long Text Area".

Reasons Behind This Solution
Basically this allows complex logics, ie perform formula calculations on a long text field, to be offloaded to a  workflow which runs on the background.  As a normal formula needs to be calculated very often and can slow down the page on each load/save, shifting the calculations to workflow helps salesforce lower the CPU usage.

Quickly Selecting Data from Salesforce Using System Log

If you just want to quickly see some data in your salesforce instance, you can execute soql queries by opening the Setup-> "System Log" and type in the following

System.debug ( [select Dealer_group_display__c from Account where Id = '001M0000005OFab']);
System.debug( UserInfo.getSessionId() );

This saves you from opening the Apex dataloader.

Developing Native Mobile Applications For Multiple Devices

If you are like me who needs to develop mobile applications, but doesn't want to stick with just one platform, you can try the following products:
PhoneGap http://www.phonegap.com/
Developers create a mobile version of their application using HTML 5 / Javascripts / CSS.  PhoneGap compile this as a native device application which can be hosted in the respective app stores.  The advantage is you are programming in HTML 5 which can than also be hosted as a mobile version of your website.  PhoneGap is free but does take a bit of configuration.

Adobe Flash Builder 4.5 http://www.adobe.com/devnet/flex/articles/mobile-development-flex-flashbuilder.html
For small applications, Adobe's latest Flash Builder 4.5.1 update allow developers to create a mobile Flex project.  It is fairly easy to learn for basic functionalities and is powerful enough to call external webservices and meet other real-life requirements.

Both products allow you to deploy to iPhones/iPads/Androids/Blackberry Tablets as native applications.

The advantage of developing uses these instead of just having a mobile version of your website is that you can minimise network traffic and provide a better user experience after the application is downloaded/installed.