Wednesday, August 3, 2016

[Salesforce] The Sobject Crusade:AssetFeed

Source: AssetFeed

This object enables feed tracking on the Asset object.

For more details about objects' Feed, go to AccountFeed object.

Enable feed tracking on Setup > Chatter > Feed Tracking:

And this is an Asset with feed tracking enabled:

Here is a simple query:

SELECT id, Type, Title, Body, Visibility, likecount, NetworkScope, (Select Id, FieldName, NewValue From FeedTrackedChanges) from AssetFeed

[Salesforce] The Sobject Crusade: Asset

Source: Asset

Asset object is a standard object that is used to track specific products that a company has purchased from your organization or from a competitor: it allows to have a history of your customer's purchase history.

Here is a query:

Select Id, Name, Product2.Name, Account.Name, Contact.Name, Status, PurchaseDate, InstallDate, UsageEndDate, IsCompetitorProduct From Asset

Monday, August 1, 2016

[Salesforce / Lightning] Geolocation Fun with Location Aware Lightning Components

Summer 16 platform release came up with Automatic Geocodes for Addresses: your Accounts, Contacts and Leads addresses are now automatically geocoded using

This means that the Latitude, Longitude and Accuracy fields are automatically populated after an address is filled (more details here).

Let's combine this awesome new feature with Lightning Components to create a component to show the nearest accounts (using the Billing Address) to the Company location.

TL;DR here is the Github repository.

To achieve this we have to make few configurations to enable the new feature.

At first activate the Clear Rules for the Account's Billing Address:

This means that when a new Account is created and the the Billing Address is filled in, will try to geolocate the address and fill the BillingLongitude, BillingLatitude and BillingAccuracy fields.

We want to use the Company geolocation as the "center" of the geo-search; unfortunately cleans Accounts, Contacts and Leads address only.

We can update the Organization's Latitude, Longitude fields manually: unfortunately these fields are updatable via SOAP API only.

To do this grab a valid Salesforce session id. The easiest way is to grab it from an open Salesforce tab using your browser's developer console:

You also need your ORG's ID: you can pick it up from Setup > Company Information or by simply querying Select Id From Organization.

Open your favorite request maker app (e.g. Request Maker) and make the following SOAP call:

Method: POST
Endpoint: https://your_org_instance/services/Soap/c/37.0/
    Content-Type: text/xml; charset=utf-8
    SOAPAction: update
<soapenv:Envelope xmlns:soapenv="" 
         <urn:sObjects xsi:type="urn1:Organization">

The component we are going to build is based on Creating a Salesforce Lightning Map Component By Christophe Coenraets.

The component will query for accounts whose location is inside a given radius in km/mi.

The first thing is to create an Apex Class capable of this query, the AccountsOnMapController, which includes the following query:

Organization orgDetails = [SELECT Id, Longitude, Latitude FROM Organization WHERE Id = :UserInfo.getOrganizationId()];
result.accounts = [Select Id, Name, BillingStreet, BillingCity, BillingCountry, BillingState, BillingPostalCode,
                BillingLatitude, BillingLongitude From Account Where BillingLatitude != null
    and DISTANCE(BillingAddress, GEOLOCATION(:orgDetails.Latitude, :orgDetails.Longitude), 'km') < :radius];
The component uses the Leaflet JS library as well and outputs the pins of all accounts found within the radius:
Each pin is clickable and in this simple implementation is capable of opening a new window with the given Account standard layout page:
The UI allow for radius and units modification, to query for different distances:

This component shows how easy is to play with location aware components, take it and add as many new features as you like!

Monday, July 11, 2016

[Salesforce] The Sobject Crusade: Article Type__DataCategorySelection

Source: Article Type__DataCategorySelection

The object is part of the Salesforce Knowledge feature.

This feature allow CRM users to create articles pr search for articles to solve customer's cases.

To enable Knwoledge base for a given user follow the following setup steps:

  1. Enable a user to Knowledge by simply adding the Knowledge User to the specific User record
  2. Setup > Knowledge Settings > Enable: once the Knowledge has been enabled it cannot be undone!
  3. Setup > Knowledge Article Types > Create new object:
    Each article type will be considered like a custom object (it will have the "__kav" trailing extension, in this case European_Offer__kav), and like custom objects you can add new custom fields:
    This article type contains all the data related to the type of article you are writing.
  4. In Setup > Data Category Setup we can create articles' category hierarchies in order to organize articles:
    Activate the category:
    Now you can create child categories inside your main category group:
  5. Now let's activate the categories in Setup > Default Data Category Visibility:
    Select All Categories if you want that a given category is visible to all profiles/roles, None if you want no default visibility, os Custom if you want certain child categories to be visible:
    Profiles / Role visibility can be customized in the Role / Profile setup page or through Permission Sets:
  6. Be sure that your categories are available on the knkowledge app, by going to Setup > Data Category Assignments:

Congratulations: you have just enabled the Knowledge Base on your Salesforce instance!

Go to All Tabs and look for the Knowledge link:

Click on the Create Article button and choose the article type you want to create:

Now you can add all the info about the article, such as the Title, URL Name, Summary and also the Category of application (in this case I set the EMEA/ITALY category ):

The article is shareable with different channels (Internal App for back office access, Partner for partner portal access, Customer for customers portals and Publick Knowledge Base for anonymous access - more details here).

Last step is to publish the article by clicking the Publish... button.

When you know create a new Case, you have the ability to check for related articles:

By default the system searches for the Case's subject.

To link this article to the case simply select the Attach to case option in the menĂ¹ next to the Article found in the article's search.

No the article is related to the Case:

The Article / Case association has been shown only to have a more clear idea on how Knowledge is used in the support processes.

And finally this is our European_Offer__DataCategorySelection object created after the Article creation:

Select Id, Parent.Title, Parent.VersionNumber,Parent.UrlName, Parent.PublishStatus, DataCategoryGroupName, DataCategoryName from European_Offer__DataCategorySelection

[Salesforce] The Sobject Crusade: Article Type__Feed

Source: Article Type__Feed

The object is part of the Salesforce Knowledge feature.

This feature allow CRM users to create articles or search for articles to solve customer's cases.

To enable Knwoledge base have a look at the Article Type__DataCategorySelection object description.

To enable feed on an article, go to Setup > Customize > Chatter > Feed Tracking and select your articole type (e.g. European Offer) and click the Enable Feed Tracking checkbox:

For more details about objects' Feed, go to AccountFeed object.

Here is what you see when enabling feed tracking on the custom article type:

Here is a simple query:

SELECT id, Type, Title, Body, Visibility, likecount, NetworkScope, (Select Id, FieldName, NewValue From FeedTrackedChanges) from European_Offer__Feed 

[Salesforce] The Sobject Crusade: Approval

Source: Approval

This object was used to store the Approval process information of the Contract object.

With Spring 15 this is read-only and cannot be created in new orgs (more details here).

This object has been replaced by the general Approval Process represented by the ProcessInstance Sobject.

Monday, June 27, 2016

[Salesforce / Certifications] Salesforce Service Cloud Consultant Certification (a Study Guide?)

The last certification I took the past weekend is the Service Cloud Consultant Certification.

I have to admit it's been the toughest, not because its questions were "heavily hard" but because the exam took part on Salesforce features I was not completely familiar with.

I cannot provide you a complete guide on how to pass this exam but I can tell you the resources I used to pass it.

A prerequisite is the Administrator certification, some hints here from Admin Hero, don't worry there is plenty of stuff on the web...just Google it!

I may say that being and certified Administrator is also necessary to understand basic features of the platform covered in the Service Cloud cert.

The main part of the exam is centered on Cases, Knowledge, the Service Cloud Console and all related features.

There is also an awesome Service Cloud trailhead module:

So happy study and good luck!