When Salesforce is life!

Author: Enrico Murru Page 11 of 20

[Salesforce] I wanna be the very best (Salesforce Developer), do you?

I’m sure you do or you’ll do after reading this post.

When I started working on Salesforce in 2009 in WebResults (an italian Salesforce Platinum Partner), and at that time I was not aware of what Salesforce actually was.

I thought it was just a coding platform, similar to the one I used to work with in my post-degree experience, with a proprietary language and a lot of point-and-click stuff.

I thought it was my first occupation on my new job and that after a while I certanly would have switched to Java or .NET in few months.

I thought I needed a lot of time to master the platform.

I thought I needed to study over books and guess by myself the solution to whatever problems I may have found, hoping a help from Google.

You know what?

After about 8 years I’m still here talking about Salesforce ahd telling people how awesome it is!

I love coding, I started when I was a child because I was fascinated on how a program worked and how an “IF” statement could lead to a window, a button or whatever you see on your laptop screen: I bought a C++ “brick-book” and finally I understood how lines of codes translates into “screen things”…and I have to admit it’s been quite a revelation (I still remember the feeling of power).

This means I love trying new technologies and making them work: I’m not like “the Guru of language X” because I love switching between technologies and find ways of using them whenever possibile.

You can think that Salesforce, as a proprietary platform, is strictly closed to its language and standards but… SUSPANCE…it’s the exact opposite my dear reader!

By working with Salesforce I had the chance to put my hands on various languages and standards, from Java to NodeJS, from SOAP to REST, from jQuery to AngularJS, browser extensions, Heroku apps, version control, command line apps…I know it seems crazy but in the last 8 years I’ve produced thousands of lines of code and a great part of them is pubblicly avaiable on my GitHub account.

Why I’m talking about my GitHub account? Am I that pretentious?

Because the greatest quality of the Salesforce world is that you can find all kind of stuff open sourced, from apps to reusable components (e.g. DeveloperForce Github profile).

And what about the documentation?

You have no need to buy anything, you can find everything online on Salesforce Docs site, thousands of pages written by Salesforce for you to learn every little aspect of the platform…if you still like reading on your books you can even print the docs’ PDF or even buy awesome books written by awesome developers!

And what about the community?

Salesforce community is AMAZING!

The entry point is the developer.force.com site: everything you need to start learning to be an awesome Salesforce developer is there!

The community counts on thousands of Salesforce developers, admins and users who share their experience on Forums, the Success Community (a place where you can find people, groups, partners), a dedicated Stack Exchenge community, thousands of Facebook and LinkedIn groups, coutless Twitter discussions, a dedicated #askforce Twitter hashtag to ask for help, blogs all over the net (click on Salesforce Blogs to get a glimpse of the most famous Salesforce blogs…and yes there is even mine), publicly acclaimed MVPs (Salesforce Most Valued Professionals, people awarded for their dedication to the Salesforce cause, and again I’m produly one of them).

And did I mention Trailhead?

Did you get how BIG and IMMENSE Salesforce is? Well…Trailhead is a “Salesforce Tutorial” for wanna be developers, wanna be administrators, wanna be users, wanna be partners, wanna be Salesforce awesome people: earn badges to show your talent and learn having nothing but fun!
You can start here following the suggested trails or you can even build your own trail with the set modules you love the most.

And what if you want to meet people on real life?

Find the Salesforce DUG (Developer User Group) near you and if you are too far you can even create your own city’s official one!

And last but not least, you can be part of the DreamForce, the MOST. AMAZING. CONFERENCE. EVER. … nothing to add more!

Imagine hundreds of thousands people all over the world that meet in San Francisco to share, learn, have fun, get some (ehm…a lot of) swag, chill out in a beatiful city.

Believe me: after DreamForce your life will never be the same!

I hope I succeeded to give you even a small idea of how amazing can be becoming a Salesforce Developer.

Everyone can build his own path to master the platform and you can start this very day for free joining thousands of people all over the world!

To increase your chances to be succesfull check this awesome ebook: Salesforce Developer Career eBook.

Believe me, you won’t regret!

[Salesforce] The Sobject Crusade: AssetOwnerSharingRule

Source: AssetOwnerSharingRule

This object allows to manage the sharing rules for Asset object.

To enable sharing on the Asset object, go to Setup > Assets > Asset Settings:

Choose wether the Asset owner will be the object creator of the owner of the parent account.

Now go to Setup > Security Controls > Sharing Settings, change the Asset OWG (Organization-Wide Default) from Controller by Parent to Private or Public Read Only.

Click the New button on the Asset Sharing Rules to create a new owner based rule:

If you select a Rule Type of type Based on criteria you can also set Asset’s fields criteria to decide which groups can share the record:

N.B. To enable access to this record, you have to contact Salesforce customer support.

[Salesforce] The Sobject Crusade: AssetShare

Source: AssetShare

This object allow a user that has access to the record to share the Asset object directly to a User or a Group.

To create such object you have to change the Asset Sharing Settings to at least “Public Read Only” by clicking on Setp > Security Controls > Sharing Settings:

Now the Sharing button will compare on the Asset page layout (if you don’t see it, add it with the layout editor):

This page shows all the users, groups, roles and territories that have access to the record.

Let’s manually add a new manual share:

And this is the result (added a group and a user):

The Expand List shows the details of the users to whom the Asset is shared:

The SOQL to query the objects:

Select Id, Asset.Name, RowCause, UserOrGroup.Id, UserOrGroup.Name, UserOrGroup.Type, AssetAccessLevel from AssetShare

[Salesforce] The Sobject Crusade: AssetTag

Source: AssetTag

This object is used to track tagging on the Asset Object.

Go to the AccountTag object for more info about how to setup tagging and see how to setup tagging on the Asset layouts:

You can select all the object layouts in which you want to use tagging.

Now you can tag your Asset object:

You can create and edit tags:

You can also have, upon feature activation, public tags, as described in the AccountTag page.

Let’s query the AssetTag object:

select id, Type, Name From AssetTag

[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

[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 / 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 Data.com.

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 Data.com 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, Data.com 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 Data.com 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/
Headers:
    Content-Type: text/xml; charset=utf-8
    SOAPAction: update
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
 xmlns:urn="urn:enterprise.soap.sforce.com" 
 xmlns:urn1="urn:sobject.enterprise.soap.sforce.com"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header>
      
      <urn:SessionHeader>
         <urn:sessionId>SESSION_ID</urn:sessionId>
      </urn:SessionHeader>
   </soapenv:Header>
   <soapenv:Body>
      <urn:update>
         <urn:sObjects xsi:type="urn1:Organization">
            <Id>ORG_ID</Id>
            <Longitude>9.114845271216465</Longitude>
            <Latitude>39.21264936045958</Latitude>
         </urn:sObjects>
      </urn:update>
   </soapenv:Body>
</soapenv:Envelope>

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!

[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.

[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: 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

Page 11 of 20

Powered by WordPress & Theme by Anders Norén