View Categories

Salesforce Integration with Agile Sync Addon

Agile Sync Addon allows you to automatically synchronize Salesforce data—such as accounts, custom fields, and object attributes—directly into your WordPress-powered Agile Store Locator.

This guide covers how to set up your Salesforce connection, map objects and fields, and run successful sync operations using the Agile Sync Addon.

Prerequisites #

Before starting:

  • You must have admin access to both WordPress and Salesforce.
  • Agile Sync Addon must be installed and activated.
  • API access must be enabled in your Salesforce plan.

Create a Connected App in Salesforce #

  1. Log in to your Salesforce account.
  2. Go to Setup > App Manager.
  3. Click New Connected App.
  4. Fill out the basic app details (App Name, Contact Email).
  5. Enable OAuth Settings:
    • Check Enable OAuth Settings.
    • Add a temporary Callback URL (e.g. https://localhost/callback).
    • Add OAuth scopes:
      • Access and manage your data (api)
      • Perform requests on your behalf (refresh_token, offline_access)
  6. Click Save and wait 5–10 minutes for the app to activate.
  7. Open the app, click Manage Consumer Details, and verify your identity.
  8. Copy your Consumer Key and Consumer Secret.
salesforce consumer key/secret

Create a New Sync Job in WordPress #

  1. Go to Agile Store Locator > Agile Sync.
  2. Click Add New Job.
  3. Select Salesforce as the platform.
  4. Enter:
    • Client ID (Consumer Key)
    • Client Secret
    • Username
    • Password (+ Security Token) or whitelist your IP in Salesforce.
  5. Click Test Connection to verify.
create-new-sync-job

Configure IP Whitelist (Optional Alternative to Security Token) #

  1. In Salesforce Setup, go to Profiles > choose your user profile (e.g., System Administrator).
  2. Click Login IP Ranges > New.
  3. Add a wide IP range (e.g. 0.0.0.0 to 255.255.255.255) for testing.
  4. Save changes.
IP Ranges

Enable Username-Password Flow in Salesforce #

If your test connection fails with a “Password Flow Disabled” error:

  1. Go to Setup > OAuth and OpenID Connect Settings.
  2. Enable Username-Password Flow.

Map Standard Salesforce Fields #

  1. Click Start Mapping from your sync job screen.
  2. Select the Salesforce object (e.g. Account).
  3. Map required fields:
    • ID → Plugin’s API Item ID
    • LastModifiedDateUpdate Timestamp
    • NameStore Title
    • Latitude / Longitude → Coordinates
    • Address Fields → Address lines
    • Description → Store Description
  4. Click Save Mapping.
  5. Enable notifications if desired (sends an email after every sync).
  6. Enable “Delete Orphan Records” to remove stores not present in Salesforce.
salesforce field mapping

Map Custom Salesforce Fields (Optional) #

Example: Map “Categories” and “Disabled” Fields #

  1. In Salesforce, go to Account > Fields & Relationships.
  2. Create:
    • A Picklist field named Categories
    • A Checkbox field named Disabled
  3. Update some test records:
    • Assign category values like Distributor, Favorite
    • Check the Disabled box for inactive entries
  4. Back in Agile Sync:
    • Click Get Objects to refresh schema.
    • Re-select Account.
    • Map Categories to store categories.
    • Map Disabled to control store visibility.
  5. Click Save Mapping.

Run the Sync #

  1. From the sync job, click Run Sync Now.
  2. After execution:
    • Navigate to Managed Stores.
    • Verify synced fields like categories and status.
    • Disabled stores will be hidden based on your field mapping.
Run the sync

Troubleshooting Tips #

  • If fields don’t appear, re-fetch objects using Get Objects.
  • If sync fails, check:
    • API credentials
    • IP whitelisting
    • Username-Password Flow
    • Correct field mappings

Video Tutorial #

Add a Clause in the Salesforce SOQL Query #

If you want to sync only specific Salesforce records (for example, accounts that belong to certain account groups), you can use the following filters to control the SOQL query that Agile Sync Addon sends to Salesforce.

Add this code to your theme’s functions.php file or a custom plugin:

/**
 * Change the LIMIT of the Salesforce query
 * Return a number to set LIMIT, or null to remove it.
 */
add_filter('asl_sync_salesforce_limit', function($limit) {
    return 500; // or return null to remove LIMIT
}, 10, 1);

/**
 * Add a WHERE clause to the Salesforce SOQL query
 */
add_filter('asl_sync_salesforce_soql', function ($soql, $config, $fields, $object, $limit) {

    //  Custom WHERE clause
    $where = "WHERE Account_Group__c = 'Black Master Dealer' "
           . "OR Account_Group__c = 'Gold Master Dealer' "
           . "OR Account_Group__c = 'Master Dealer'";

    //  Apply LIMIT if it is set
    $limit_clause = ($limit !== null && $limit !== '') ? " LIMIT {$limit}" : '';

    //  Build and return the final SOQL query
    return "SELECT " . implode(',', $fields) . " FROM {$object} {$where}{$limit_clause}";

}, 10, 5);

Need Help? #

If you encounter issues, contact our support team at support@agilelogix.com with:

  • Your sync job settings
  • The object name and field mappings
  • A screenshot of the error (if any)