Saturday, June 28, 2014

How to configure your android device for office and personal work

Ok so this is a slity non saleforce related topic but it is very useful. It will also be helpful in facing some saleforce related task. So here it goes, if you need a proper configuration then get these things setup in your device:

1. Setup your gmail account and link it with your phone.

2. Setup your office mail in the mail application.

3. Use google calander to plan meeting and share it with people.

4. Install google drive, watsup, viber , skype, adobe reader, winzip and quick office.

5. For saleforce users install saleforce1 and saleforceA.

6. Use 3g networks for good speed.

7. Use google map to share path ways for office location or meeting halls.

Feel free to add more fetures by posting in the comments section.

10 things you must have if you are a traveling saleforce developer

The world of saleforce is so connected and vast that many time it may bappen that you have to go to other cities for work or meeting. And if you are a developer or admin it might happen you have to develop or config some of the changes that customer asked ASAP. Here are 10 things you must have so you can complete the task

1. A decient internet connection, if you have dongel its good but if not then at least a 3g enabled mobile phone with modem support. You can easly attach android to laptop via usb cable and share data connection by going in setting>tethadering port>usb tethadering.

2. Eclips helios for developing and depoloyment related task.

3. List of all username,password and security token.

4. SaleforceA installed in your device, believe me its very usefull for smaller task like resetting userpassword.

5. Saleforce1 for recent changes for mobile varification.

6. Link for database.io an online data loader.

7. Saleforce Soql guide for reference.

8. Wight list your ip if you are accessing the org from some other or new network. Note this has to be done before flying out or ask your admin to provoid you.

9. Microsoft excel or open office installed for accesing importand document. Or if not use chrome it has pdf and doc support in built.

10. If you have laptop that you carry then admin rights, some time we need to install thoes handy little software to debug webservice callout failure.

Hope this help you out have a nice day.

Friday, June 27, 2014

Hot to read debug logs in salesforce

There are times when we have that one buggy code and to get it sorted out we have to make our hands dirty. Reading the debug code log is a very frustrating task. If you have to do it keep the below points in mind it might help you.

1. Always search for "USER_DEBUG" chances are the may be some with logical values.
2. If the code is going in catch block search for "Exception" it will quickly show the error message.
3. The loop variables and flow will again return to the start of the execution.
4. Always read the line number in "[]" as we can quickly which line the code went in.
5. If the code debug is for trigger then remember that before events value changes are not captured in log implicitly.
6. If you have manage package with triggers then for the triggers the values will appear in separate limit log in side debug log.

Hop these tips help you get most out of debug logs.

Thursday, June 26, 2014

How to use "Savepoint" and "Rollback" in apex Salesforce

Many times when we are coding and handling exception we do not thing about transaction control. Transaction control is a process to handle the flow to data that is being committed to data base based on the condition that satisfy our logic. Consider this in a code flow you are updating Account and at the same time you are creating related Opportunity records, this is in try catch block and the yet to be created Opportunity records do not satisfy the validation condition and fails to insert, but the Accounts are already updated and because it is a try block the error is just thrown to catch which do not do any thing.


We can use "Savepoint" and "Rollback" to revert the changes that "Update" operation has done.

Example:
In the above code we are setting "Savepoint" at line 9 and reverting database at line 17.
Hope this help some one.

Wednesday, June 25, 2014

How to have sorting in list for visualforce Salesforce

Many time when working with visualforce page to display list of records to the user the commonly asked feature is to have sorting. Sorting can be easy achieved by using standerd saleforce having the below structure :

[ORDER BY fieldExpression ASC | DESC ? NULLS FIRST | LAST ?]

or simply it can be written as :

SELECT Name FROM Account ORDER BY Name DESC NULLS LAST

But that is not the only way, we can do this by the below mentioned ways:
  • Sorting (Order By) in SOQL.
  • Using List methods to sort list.
  • Custom sorting.
Sorting (Order By) in SOQL.
Example : SELECT Name FROM Account ORDER BY Name DESC NULLS LAST

Using List methods to sort list.
Example : List.sort();

Using this method, you can sort primitive types and sObjects (standard objects, custom objects, and SelectOption). For more information on the sort order used for sObjects, see List Sorting. You can also sort your own custom types if they


Custom sorting.
Example :