Search
Twitter
Monday
Jul142014

Salesforce Dataloader Heap Space Exception

If you are trying to upload and download large volumes of information using the Salesforce Dataloader you might run into this error. "Java Heap Space" from the Data Loader UI version 21.0 onwards This is common especially if what you are loading is large attachments (PDFs, Powerpoints etc). The Salesforce Dataloader is a Java application that runs on the local Java Virtual Machine (JVM). The heap size is essentially how much memory is allocated to the application while it runs. Starting with version 21 of the Salesforce Dataloader the heap size is more restrictive than in past versions. There are some quick fixes to get your around this issue.

Click to read more ...

Thursday
May152014

Using An Apex Map with a List of sObjects

The other day I found this handy. It's a slight twist on something I found in the developer documentation. Ultimately I wanted to quickly compare some Account IDs and see if any from list A were in list B and if so, perform an action on the Accounts in list B. I decided that a map would be good for this task.

First, a quick review of what a Map is. A map is essential a key/value pair list. Here is the textbook definition:

A map is a collection of key-value pairs where each unique key maps to a single value. Keys and values can be any data type—primitive types, collections, sObjects, user-defined types, and built-in Apex types. - Salesforce Developer Documentation

A Map is perfect for this particluar task because Salesforce object IDs are unique just like the key in a Map. There is only ever going to be one.  

Below is a snippet of an "auto" populated map of the Accounts I was interested in.

 

List<Account> listAccountsWithSupport = [select Id,Name from Account where HasPaidSupport__c =  true];
Map<Id, Account> mapAccountsWithSupport = new Map<Id, Account>(listAccountsWithSupport);

I can now quickly compare the Accounts I have in List A with this second set of Accounts stored in a map. Both A & B could actually be maps but the method I'm working with in the legacy code already returns a List for the Accounts in pile A.

for(Account a: listAccountA){

//check to see if the current account in list A matches any in our Map (which is pile B)

  if(mapAccountsWithSupport.containsKey(a.Id)) {

      a.HasPaidSupport__c = true; //perform the desired action

/*we can also perform actions on any of the accounts in the Map if we want by using a.Id to find a specifc Account. Below will return the actual Account object based on the  key "id" if it finds one. At this point you could perform an action if you wanted. */

     Account tmpAccount = m.get(a.Id);

  }

}

update listAccountA; //make sure to call any updates outside the loop :)

 

Tuesday
Jan282014

Three Common Apex Coding Topics

If you're an admin of a big Salesforce org, then you probably had some users complain about unfriendly errors. If your Salesforce org is in any way customized then those errors are likely related to performance issues in the custom Apex code. Although custom Apex code can be powerful, it can sometimes hinder the overall performance of your Salesforce org. Today, I'm going to introduce three changes you can make in Apex Code that will improve the performance of your Salesforce:

 

Enhance Validation and Workflow Rules:

One example of the errors your users might get is one that includes FIELD_CUSTOM_VALIDATION_EXCEPTION. This error usually means that you have a scheduled batch that inserts/updates records without fulfilling a Validation Rule(s). Here are a few areas you can improve performance:

  • If you have a batch class, make the class calls a DML operation and that opt_allOrNone is set to False. This will allow the rest of the operation to still succeed even if the record fails.
  • Workflow Rules are most helpful in preventing duplicate records. If you have a lot of Workflow Rules in your org, you can cut down unnecessary processes by deactivating the Workflow and improving the Trigger to do the Workflow Rule'sjob.
  • Review Validation Rules with management and make sure they are necessary to fulfill business logic. Having too many validation rules and required fields can cause unit tests to fail, which will then prevent you from deploying a change set.

Increase Field Length:

If, for example, you have a Trigger that populates values larger than the field length, then you'll most likely get a STRING_TOO_LONG error message. One thing you can do here is to increase the Field Length; it is better to have a large value than getting an error message.

 

Rectify API Limits:

If your org has a lot of integrations with third party apps and that those integrations are used frequently, your users might then see a "REQUEST_LIMIT_EXCEEDED" error. There's no ideal solution to reducing API usage, but one thing you can do is to evaluate the current API usage in your org (SetupAdministration SetupCompany ProfileCompany Information) and figure out a way to reduce and disperse the number of API calls.

 

It is always a good idea to periodically review the current custom Apex Code you have in your org with management and stakeholders. Making these changes will not only cut down the number of errors your users encounter, but will help improve the performance and the overall user-experience in your Salesforce.

Friday
Jan032014

Salaesforce.com Tip: Freeze Users

When administering Salesforce, you can at times run into scenarios where a particular users’s account should no longer have access. An example of that is when you have reason to believe that a user’s account has been compromised or someone has just left the company and you want to prevent them from logging in. Normally you would just disable the user; however, if the user is part of a custom heirachary field - there are more steps invovled. A nice solution in the meantime us to just use the "Freeze" function. 

To freeze a user in your org, go to Your NameSetupManage UsersUsers. Find and click the user and then click “Freeze” to freeze the account. 

salesforce freeze user
After the user is frozen - the Freeze button changes to an Unfreeze button which performs (well, you get the idea).
Note: When you freeze a user, it does not free up a user license. In order to actually free up a licnense you have to perform an actual deactivation of the user.
Tuesday
Dec172013

Generate a Report Right From the Record Page

One of the major perks of using Salesforce.com is its robust Reporting tool. Although the Reporting tool is quite capable, one drawback of it is that it's somehow separated from where you'd mostly spend time working through the data. If you're looking at a particular Lead record and wanted to create a report, you'd have to navigate to the Reports tab and create a report there. Today, I'll be showing you a quick way to create a report from the click of a button right from the record page. For my tutorial, I'll create a button an place it on the Leads page- I will then have the ability to generate a report on All Open Leads; right from that button.

Click to read more ...

Thursday
Dec122013

Custom Objects in Salesforce

In Salesforce, you're able create a custom object to store a particular set of data where users can create and manage that data all under a tab . Today, I'm going to show you how to create a custom object in Salesforce and place its data under a tab.

 

Building the Structure of the Custom Object :

In this tutorial, I'll be creating a "Reservations" custom object to be able to create and track customer reservations.

  • To get started, go to SetupApp SetupCreateObjects. Then click "New Custom Object."

  • Next, fill in the name for the object and click "Save."

  • Under Optional Features, make sure to allow for Reports, Activities, and Tracking Field History.
  • Next, I'm going to allow for Adding Notes and Attachments. Tick the checkbox to "Launch new Custom Tab Wizard" to customize the look and feel of the tab.

Creating the Tab for the Custom Object:

Now that I've built the structure of the custom object "Reservations," I can create the Tab where the object will be stored.

  • Pick the appropriate style of the tab and click "Next'.

  • Next, add the profiles you want to see and/or use the "Reservations" objects, then click "Next".

 

  • Then, determine which Salesforce apps you want this object to be available and click "Save".


  • Finally, under Custom Fields and Relationships, create the appropriate custom fields for the object. I'm going to add a new custom field "Reservation Date and Time"
  • Now, you can see the "Reservations" tab at the top where you can create new reservations.

Tuesday
Dec102013

Standardize Countries and States in Salesforce

Often times importing new data into your Salesforce org will result in having inconsistent data. This inconsistency is particularly found in Countries and States/Provinces, such as the values (US, Usa, us, usa) where they should be updated to United States, instead. Today, I'm going to give a tutorial on how to use Salesforce's Mass Update Addresses; to standardize your countries and states.

Standardizing Countries:

Initially, you want to update the countries first then the states. To get started:

  • Go to your name> Setup> and search for "Mass Update Addresses" or go to Administration Setup> Data Management> Mass Update Addresses
  • Select "Country", then click Next.

  • From the "Available Values" column, select the countries you want standardized (this view can display a maximum of 100 countries, if you can't find the countries you want updated, search for them in the above search box) and add them to the "Selected Values". Then, enter in the new name you want applied to the selected countries and click Next.

  • After that, you'll be shown a list of where records of those countries are found. Click "Replace" to replace all those countries with the new one.

Standardizing States:

Now that you've updated the countries in your org, standardize the states in those countries:

  • In Step 1, select "State/Province" and enter in the country in which the states belong to and click Next. 

  • Pick the states you want updated and enter in the new name and click Next. Then, review where those states are found in your data and click Replace to replace them with the new name.

Tips on Mass Updating Addresses in Salesforce:

  • Always standardize the countries before the states.
  • Keep in mind that once you've updated the values of countries and states, all associated filter conditions will be affected and that includes: assignment rules and web-to-lead, which then should be updated with the new values.
Monday
Dec022013

Salesforce Lead Queues

In Salesforce, Queues allow for management and organization of records in Leads, Cases, and custom objects. Lead Queues are particularly helpful because they allow you to funnel a group Leads into a queue based on a particular criteria whereby users in that queue can claim ownership of those Leads. For example, you can create a Lead Queue to distribute newly created Leads or those captured from web by region/territory (West Coast, North Pacific...etc) Today, I'll be giving an introduction on how to create a Leads Que.

Creating Regions/Territories:

First, we're going to create a queue for each region.

  • To get started, go to Setup> Administration Setup> Manage Users> Queues and click New.
  • Name the Queue and optionally, you can assign an email address specific for the queue; users in that queue will receive updates on actions.
  • Next, pick the object you want to create the queue in.

     

 

  • Next, assign users to the queue. Alternatively, you can assign a Group of users to a queue. Then click Save.

Assigning Rules for Lead Queues

Now that you've built the queue, it's time to create rules to automatically assign users to the appropriate region/territory queue. Go to Setup> Customize> Leads> Assigning Rules and click "New". In Assignment Rules, you can prioritize the order of rules.Assigning Rules will run on an ascending order.

  • First, set the order of the rule.

  • Enter the criteria on which you want the Assignment Rule to apply
  • If you have multiple rules and depending on the logic, you can modify the logic of the rules right under the list.

  • Finally, enter the name of the queue you want the records with the above criteria to go to. click Save.

 

And now, users assigned to the queue can have a list view of all records in that queue where they can assign ownership accordingly. Only those users and users of higher hierarchy will have access to that list view.

Friday
Nov152013

Salesforce: Create Your Own App Marketplace

Last month, Salesforce announced Private AppExchange-- a feature that lets managers create a private app marketplace with a specific selection of apps totally private to their organization.

Click to read more ...