Category Archives: data cleansing

SQLForce – ANSI SQL for SalesForce

There are great tools for SalesForce that we don’t hear much about:

SQLForce – Command line interpreter with ANSI SELECT/DELETE/MODIFY//INSERT commands that work with Salesforce.


My 1st little App Exchange: SOQL Query Tool

As a little exercise, I’ve created a small tool comprised of a VisualForce page/tab that allows system administrators to run ad-hoc SOQL (SOSL and aggregate queries) from within their applications and do mass update on every page of 100 records. Basically, it reproduces a little of the functionality of the DeveloperForce utility Mass Update Anything.

This tool is available at the AppExchange for free:

(The listing is private because SalesForce seems to only allow SalesForce Pardners – that is, companies – to take their apps to security review and make them public.)

SOQL Query Tool screenshot

The results of an ad-hoc query executed in SOQL Query Tool (click to expand).

In one class I used ApexPages.StandardSetController with a Database.QueryLocator to implement pagination of the query results.

objStdSetCtrl = new ApexPages.StandardSetController( Database.getQueryLocator( SOQLText ) );

In the VisualForce page I used the tag apex:repeat to display a dynamic list of columns nested in an apex:pageBlockTable that iterates on the query results’ rows.

<apex:pageBlockTable id="ResultsTbl" value="{!QryResults}" var="row">
    <apex:repeat id="ColumnsRpt" value="{!LstColNames}" var="col">
         <apex:column >
                <apex:outputLink rendered="{!( col == 'Id' || col == 'Name' )}" value="/{!}" target="new">
 <apex:outputText value="{!row[col]}" />

Facilitating removal of duplicate contacts

Purpose: display a link to the Merge Contacts Wizard from the search screen and from the contact screen

Too many times users search for a contact but end up creating a duplicate anyway.

Most of the time is because they use the first contact that appears and they leave blank the fields you configured in DupeCatcher.

What follows is a way that – hopefully – will make it easy for them to remember to avoid and remove duplicates.

Even if it doesn’t help with that, at least it will make it more convenient to merge duplicates by giving a link to the Merge Contacts Wizard from the search screen and from the contact screen.

1) Create a field named Merge Duplicates (Merge_Contact_URL__c) as Formula(Text) and enter the formula as:

HYPERLINK(‘/merge/conmergewizard.jsp?id=’ & AccountId & ‘&srch=’ & FirstName & ‘+’ & LastName, ‘Merge Duplicates’, ‘_blank’)

2) Enter Description as: Link for opening this contact in the Merge Contact Wizard

3) Enter Help Text as: Click this link if you want to find and merge duplicates for this contact

4) Then add to the Contact Search layout:

5) The convenient link will appear on your search results like this:

6) You can also create a custom button that allows the same function from the Contact itself:

7) Just remember to add the custom button to the page layout: