Sonoma Partners Microsoft CRM and Salesforce Blog

Predictive Vision Service - Step by Step

Today's blog post was written by Mike Sherry, Developer at Sonoma Partners.

Part 1: Creating and Using a Model

Salesforce recently rolled out a really cool feature for its new Einstein AI platform: Predictive Vision.

The Predictive Vision service allows users to upload pictures to a pre-trained model, and the model returns its best guess (plus a few other probable options) of what is in the picture.

The application of this service maybe isn’t immediately obvious, so let’s imagine you’re a mechanic and you have your own repair shop. Actually - let’s imagine you’re a starship mechanic. That’s more fun. Your clients are sending you pictures of their busted up ships; they want you to send them repair estimates, and – being starship pilots – they want them fast!

Ship's Broke...

Ship's Broke...

The galaxy is a big place, filled with lots of different starships, so you can lose a lot of time figuring out which ship you’re looking at. Predictive Vision to the rescue! Using Salesforce’s API, we can build a robust model of all of the different types of ships that you work on. Then, when a customer wants an estimate faster than the speed of light, all you need to do is run their picture through your model, and you quickly know what kind of ship you’re working with. Since you already have a Salesforce platform complete with replacement part prices, cost of labor estimates, and everything else that goes into your business, we can build a slick tool to tie it all together – but that will have to wait for another blog post. For now, let’s get up and running with Predictive Vision.

Let’s Get Started

It’s easy to sign up for the Predictive Vision service and hook it up to your Salesforce org. The documentation provides excellent step-by-step instructions for creating a certificate from your Salesforce org, downloading the certificate, and then using it to create a new account, so we won’t go over it in depth here. There are also code repositories provided by Salesforce that allow you to quickly create a basic Visualforce page that utilizes an already created image classifier in your Salesforce org.  All you have to do is clone the code repositories, copy the code into your org, and then follow the instructions provided to get the Visualforce page set up.

Now that we’ve got our very own account and it’s hooked up to our Salesforce org, we can try out the Predictive Vision service using the default image classifier. Since we need it to identify space ships, let’s see how the default classifier does…

It IS a Space Shuttle. Not Bad!

It IS a Space Shuttle. Not Bad!

The model is 99.9975% sure that this is a picture of a space shuttle. Pretty cool! Maybe we can use the default model and be done with this project right now! Let’s test it with the picture of our customer’s broken ship first.

Definitely Not a Can Opener

Definitely Not a Can Opener

Syringe… nope. Can opener… nope. Slide rule… nope. Space shuttle? Eh. Close, but still not what we need.

The image classifications are only as good as the model we use (and the model is only as good as the data we give it – more on that later). The default model is pretty impressive, but we’ll get much better results if we have a model specifically tuned to the kinds of images we want to classify. So, let’s see how to create a Model of our own.

Create a Dataset

To create a brand new model, we now have to leave the Salesforce org and work directly with our account. has a pretty simple REST API that allows you to create new datasets, add labels, upload photos, create models, and classify new images using the models you create. Their documentation shows what the REST calls look like if you’re using cURL to communicate with, but they’re pretty easy to translate into whatever language or tool you’re most comfortable with. There has been some talk from Salesforce that they will be releasing wrapper functions for Java, Node.js, and other languages in the future. For now, though, we have to make our own.

The first thing to think about when you’re working with the API is how you’re going to get an authorization token. There is a shell script available here which will generate a token for you. It’s designed to run in a Linux or Mac environment, but we were able to get it working in Windows with a little bit of editing.

The easiest solution, however, might be to simply load the sample Visualforce page that Salesforce provides us. They went through the trouble to write an Apex class that gets an access token, so we might as well use it! Remember when we tested the general model? Right below the image, there’s a field called “Access Token.” We can simply load that page and copy the token. It’s valid for one hour and if it expires, we can just reload the page to get a new one.

Sample Visualforce Page with an Access Token

Sample Visualforce Page with an Access Token

Here’s an example of a wrapper function we wrote using Node.js and its request library to create a new Dataset:

Mike sherry 5

To call the function, we just give it a name for the dataset and a list of the labels we want. In our case, the dataset will be called “Starships,” and we’ll give a label for each of the different models of starship we repair at our shop.

Mike sherry 6

The API call returns a JSON object with a dataset id and a list of all of the labels in the dataset, as well as ids for each label. Keep this information around, because we’re going to need it later.

Add Some Images to the Dataset

Now that we have a dataset, we need some sample images to help our model know what it’s looking for. Salesforce recommends providing at least 1000 images per labels, and they also recommend ensuring that each label has roughly the same number of pictures.

For this example, we used about 30 pictures per label and it gives pretty good predictions, so your results may vary if you’re using more or less labels and what sort of images you’re using as input.

To add an image to a dataset’s label, use the “Create an Example” endpoint. You’ll need to convert the image on your hard drive into a file stream. In the Node.js example below, we used the fs library to do the conversion. You’ll also need to pass in the model and label id so that knows where to put the image. You can send a request to the “Get a Dataset” or “Get All Datasets” endpoints if you forgot the dataset/label ids.

Mike sherry 7

Once you upload an image, it can take a few minutes for your to process it and have it ready to do more work (training, returning information about your model). You’ll know it’s ready when you can hit the “Get an Example” endpoint and it returns information instead of an error message. If you get an error, give it a few minutes and try again.

Train the Model

Once you’ve created a dataset and loaded all the images, training a model is easy! All you have to do is make a REST call to the “Train a Dataset” endpoint. Again, you can use cURL or write wrapper functions in your language of choice. You just need to provide a name for the new model and the id for the Dataset the Model will be generated from.

The service returns a JSON object with some information about how the model is being trained, the dataset its using, its current status (it can take a long time to create a model if there are a lot of pictures in your dataset), and most importantly, the model id. To see if the model is ready, send a request to the Get Training Status endpoint.  When it’s ready, you can get some information about your Model’s accuracy by sending a request to the Get Model Metrics endpoint.

Once the Model is ready, you can copy the Model id back into your Salesforce Apex logic and classify images using the new Model!

Let’s Try It Out!

To use the new model, we’ll go back into our Salesforce org and pull up the controller class for the sample Visualforce page we made. Then in the getCallVisionUrl() method, we’ll change the final line so that it passes in our new Model’s id instead of "GeneralImageClassifier" and a URL to the image we’re trying to classify. It will look something like this:

return Vision.predictUrl('http://myimageurl.jpg',access_token, 'myModelId');

Nailed It!

Nailed It!

Our new model is 99.174% sure this is a picture of an X-Wing. With this information, we can now build out a more useful page that populates a service form with potential replacement parts, reputable part vendors, cost estimates, and all sorts of other information we already have in our Salesforce org. We’ve already learned a lot about predictive vision in this post, though, so the full integration of Predictive Vision with our estimate app will have to wait for another post.

NEXT TIME: Integrating into Lightning Components

Topics: Salesforce

Looking for Our Pot of Gold with Spring '17

Today's blog post was written by Troy Oliveira, Principal Developer at Sonoma Partners.

If you’ve logged into a Salesforce sandbox in the last couple of days, you may have noticed that things are a little sunnier than they were last week.

That’s because Salesforce updated sandboxes to the Spring ’17 release over the weekend.

As we’ve come to expect over the last few releases, a big theme in Spring ’17 is LIGHTNING, LIGHTNING and more LIGHTNING. Apparently after all of that lightning has cleared up, you’re left with a fun, animated rainbow. Does this mean that there isn’t anything of value for Classic customers? Hardly, but it does continue the pattern of Salesforce focusing a great deal of their efforts in making Lightning the future of the platform.

Troy o 1

Service Cloud, Struck by Lightning

The big ticket item in Spring ’17 has got to be the Beta release of Service Cloud Lightning. Salesforce has completely overhauled the Service Console that we all know and love from Classic and turned it into the Salesforce Console for Service.

Troy o 2

This marks the last major cloud to move into the Lightning Experience and has led to some pretty fun innovations under the covers that benefit the entire platform.

Knowledge has been completely re-imagined for Service Cloud Lightning and as a result, this is a place where moving from Classic to Lightning will require some additional configuration and migration of data.

Other key takeaways for the Service Cloud Lighting also include Live Agent, an iOS App for Field Service Lightning and a more streamlined setup experience (We'll post more on these features soon!).

Making Lightning Yours

As Lightning has grown in feature parity, Salesforce has started to put a great deal of effort into making the interface configurable to and allowing more flexibility for granular control of the look and feel.

A big step forward in Spring ’17 is the ability to create Lightning Pages that can be scoped to Profiles or Record Types. This was a heavily used feature in Classic page layouts, but now extends even further by allowing for even more customization beyond just the “Details” that are shown.

Paths and Kanban

In the initial roll-out of Lightning, Salesforce provided a Kanban view of Opportunities. This provided a great way to be able to see (and make changes to) Opportunity records based on what stage they were assigned to. In Winter ’17, this was expanded to include Leads as well.

Now, the same abilities have been extended to Quotes and Custom Objects. Add your own custom Paths, and you can have a custom Kanban view of your Custom Object. This will provide you with the same ability to track stages and milestones for your custom objects as already existed for Leads and Opportunities.

These are my favorite things!

Finally, I come to what is probably one of my favorite new tidbits that has been thrown in with Spring ’17 but isn’t getting much buzz: the ability to mark records and views as “favorites” in Lightning. Much in the same what the bookmarks help make your web browsing experience more targeted, Favorites will keep you from stumbling through Salesforce looking for that exact right view of what you need to see. Simply click the  button in the global actions portion of the page to mark “favorite” it. And voila, you have a quick link back to the page that you can get to from anywhere. Switching between apps? It doesn’t matter; the favorite keeps tabs of what app you were in when you clicked it.

Troy o 3

Don’t just take my word for it.

Obviously these are just some of the highlights that I’ve found to be particularly exciting. For more information about the Spring ’17 release check out the Release Notes or the Salesforce Releases YouTube Channel for more.

If you have any questions on how Spring ’17 will affect you or would like some help getting started, please Contact Us. We’d love to hear from you!

Topics: Salesforce

Is Your CRM (Einstein) Smart?

Today's guest blogger is Aaron Robinson, an Engagement Manager with Sonoma Partners.

As the year comes to a close, Salesforce is wrapping up their New York World Tour - one of many for the coming year.

Even if you only watched with one eye open, you probably picked up on the common theme driving the conversation around the Salesforce platform – artificial intelligence, or AI for short.

While most people's personal experience with AI is probably summed up in the decades of sci-fi movies, it has inched its way into the consumer world of apps we use everyday. I would be willing to bet most people don’t even recognize AI in action when they see it, which is partly the beauty of having intelligent applications. Ever wonder how Netflix knows which movies to recommend for you or how Pandora can play hours of music you will enjoy without you having to select each individual song? These types of algorithms and the predictive power amassed by AI drives these types of little life improvements. Its the tip of the iceberg in terms of what we will see in the future, and if you want a little taste of how life changing this can be, take a ride in a self-driving Tesla.

AI for the (Business User) Masses

Einstein 1One of the great things that Salesforce is known for is marketing, and they do marketing on their own products about as well as anyone. AI has been taking shape in the technology world in many different forms because it’s such a broad topic – natural language processing, activity recognition, bots, machine learning, and sentiment analysis. There are many more, but Salesforce wishes to embody the spirit of their brand of AI into something easily recognizable and understood by anyone who encounters it. And what better way than to identify with one of the most revered human minds that ever existed: Albert Einstein. Also in traditional Salesforce style, they have created a cute and crazy haired little persona for their branded technology.

Salesforce Einstein is branded as “the first comprehensive AI for CRM.” Salesforce has integrated artificial intelligence technologies into the underlying platform to make their Customer Success Platform smarter and more importantly, usable by the average business user without the need for significant training. Salesforce states their differentiation in the marketplace in three key pillars:

  • Data-ready — You don’t have to do data preparation or manage models. Just put the data in Salesforce, and it works.
  • Modeling-ready — Multi-tenant, automated machine learning means the right model automatically fits to your organization.
  • Production-ready — No DevOps needed. It’s part of the same trusted Salesforce platform, with model management and monitoring tools.

All of the available clouds offered by Salesforce can take advantage of Einstein as its built into the platform layer of the application, shown in the graphic below. Einstein encompasses those forms of AI which I mentioned previously such as predictive analytics, machine and deep learning as well as natural language processing.

Einstein 2

The Smarts in Action

During the various cloud keynotes, Einstein was shown in action, driving analysis and serving up logical next steps to help improve various outcomes.

Sales Cloud Smarts

The Einstein conversation around sales focuses around leads and opportunities and how we can identify and develop the customers who have not only just raised their hands, but performed actions to tell you they are serious about your product or service. Depending on the industry, market, regulation, or service, selling always comes with its unique set of challenges. But what if your CRM platform could help evaluate how your sales team should be spending their time, recommend best next steps, and even facilitate automated follow-up? Ultimately, this would help focus their time to managing relationships and providing true engagement before, during, and after the sale.

Einstein 3

For the Sales Cloud user, the goal is to help your reps sell smarter with the help of Einstein. Salesforce starts you on the process with two key features: Predictive Lead Scoring and Opportunity Insights. For the inside sales team, predictive lead scoring ranks their leads in Salesforce using the attribute data. The insights pane on the lead will not only show a score but also the factors from the lead record that influenced the score, including lead data and activity performed by the individual tied to the lead. Assuming you’re using some related Salesforce marketing technology, you can even view a history of the engagement with the individual, including website visits, meeting acceptance, and from completion. This allows the rep to have a more intelligent and engaged conversation around your product or service.

Service Cloud Smarts

Providing great service isn’t just about solving a case quickly, but in the consumers’ eyes a connected and “conversational” approach to service. As a consumer with a basis towards the use of CRM systems, I’m totally befuddled by my interactions today with service reps, and the experience leaves me feeling like they know nothing about me. Not only does Salesforce help to bridge that gap, but they are using Einstein to serve up relevant information to the agent at the time of service to make that interaction personal and engaging.

To do this, Salesforce is enabling some new functionality, such as engaging customer through SMS text messaging, chat through Facebook messenger, and enabling Service Cloud bots. These features will help to drive quicker connection for service. But the real power comes through in how Einstein can help improve the customer interaction.

Einstein 4

Take this scenario, talked about during the Service Cloud key and a real frustration of mine when I call for service. Imagine chatting with an agent for support, only for them to ask if you mind being put on hold while they do a bit of research. And often that first hold isn’t enough, but they will come back and ask repeatedly for you to hold. With help from Einstein, agents can get recommendations based on the information they have collected, to help guide the experience in real-time, versus having to make the customer wait while the agent searches for a solution. And as cases get resolved, the system only gets more intelligent using the actions performed to solve the case to better predict how to solve similar cases in the future.

Marketing Cloud Smarts

Now why should sales and service get all the cool tools? Well, in Salesforce they don’t. Marketing is also served up a healthy dose of IQ points to make their engagement more effective. Consider a few of the following use cases conveyed during the Einstein Keynote...

Marketers can utilize the Journey Builder to build smart journeys that are individualized by the specific customer’s preferences. One such feature is the Smart Split which determines what are the best channels to reach a customer based on their preferences. Einstein will analyze the activity for a given customer to determine which channel is most likely to illicit a response – for customer A this may be email, while for customer B is might be text, and customer C is a Facebook ad. When a customer reaches this step in the journey, Salesforce will use the appropriate channel for that targeted communication. A similar intelligent path is based on time – when is the most optimal time to send the message to a customer. Using a time-optimized step in the flow, the message can be sent at the optimal time for the particular consumer. And this is just the beginning, so check out the keynote in full to see other options for features like predictive vision services (in beta) for product recommendations.

The Future is Here

At first blush, this is very compelling. It can be applied to such a wide range of challenges for different industries and business models. The part to keep in mind is that while it seems tempting to just jump in head first, it’s important to look at your business and where there are processes that can be improved with the use of AI. Also, there are distinct use cases where Einstein makes sense today, so it’s important to make sure your use cases match those. In the upcoming releases for 2017, we’ll look for improvements to Einstein and how that can be leveraged even further.

If you’re interested to learn more, head over to the Salesforce’s Trailhead and search for Einstein. If you’re curious how Salesforce Einstein can potentially help improve your business, we’d be happy to talk to you as well. 

Three Steps to CRM Success

Topics: Salesforce

Integrating MDR education and school data with your deployment

Sonoma Partners works with multiple customers in the education industry, and they frequently ask us about integrating MDR's school data with their CRM system. If you're not familiar with MDR, they provide the most comprehensive set of data about schools and school administrators throughout the United States. Most folks consider MDR data as the "gold standard" in the education industry. If your business works with schools, that means you have a fixed universe of customers to sell to. Consequently, having clean and accurate data about schools and their contacts becomes hyper-critical!

To help make sure that our education customers have clean school data in their CRM system, Sonoma Partners developed a process to update CRM with the latest and greatest MDR education industry data on a regular basis. The MDR data updates include detailed information about both schools (accounts in CRM lingo) and administrators (contacts). Some of the data points provided by MDR include:

School / Account Sample Data Points (this is not the full list, there are over 300+ MDR account fields and 85+ contact fields)

  • MDR District Enrollment
  • MDR District Classification
  • MDR District Grade Span
  • MDR District PC Computers
  • MDR DMA Code
  • MDR School Improvement
  • MDR School Type
  • MDR Technology Sophistication Index
  • MDR Student Enrollment
  • MDR Student to Computer Ratio
  • MDR Number of Classrooms
  • MDR Number of Schools
  • MDR Open Date
  • MDR Total Budget
  • MDR Total Number of Students
  • MDR Total Software Budget
  • MDR Total Technology Budget

Administrator / Contact Sample Data Points (this is not the full list, there are ~25 MDR contact fields)

  • MDR Status
  • MDR Title
  • MDR Last Name
  • MDR First Name
  • MDR Middle
  • MDR Name
  • MDR Preferred Title
  • MDR Gender
  • MDR Last Update Date
  • MDR Job 1
  • MDR Job 2
  • MDR Computer User
  • MDR Advanced Placement
  • MDR Years at School
  • MDR Years of Teaching Experience
  • MDR Highest Degree Level
  • MDR Email Address

 After integrating the MDR data with, the end users can view and access the data through the user interface and it will appear like the following:


MDR publishes refreshed and new data several times per year. Our integration updates all of the Account and Contact MDR data fields with each MDR refresh.  We recognized that our customers will be updating their Account and Contact data directly in Salesforce as well, and they may have more accurate information earlier than what MDR collects.  Therefore, we set up an exception process so if a user directly updated any of the MDR data fields, the integration will not update a manually modified data field with the MDR refresh for at least 6 months. Please keep in mind that we setup this exception process on a field-by-field basis.  For example, if a user updated the Phone number last month, but all of the other fields have not been updated in over 6 months, when the MDR refresh is run, all of the Account fields listed will be updated except for the Phone, which will not be overridden by the MDR integration.

We also recognized that you might NEVER want some fields overriden by the latest MDR data refresh (for example the email, Billing Address or Shipping Address).  To accommodate these scenarios we created a “Never Update from MDR” checkbox directly below each of these three data fields.  If you do not want your information overwritten, users can check this checkbox for the appropriate field.



Lastly (and maybe most importantly), MDR provides hierarchy data about how the schools rollup to districts, sub-districts, etc. This hierarchy data allows companies to perform rollup calculations of they well they perform within districts at an aggregate level. Consequently, companies could answer questions like "What's our total sales pipeline in District XYZ? How much of product X did we sell to sub-district ABC in the last 12 months?" This screenshot shows how we modeled the school hierarchy within


The MDR data integration with CRM provides our education industry customers with several benefits, including:

  • Accurate, cleansed account and contact data
  • Access to full universe of education customers based on standardized industry database
  • A repeatable data load process
  • Reduced need for manual record maintenance
  • Better information to make informed sales and marketing decisions

And yes, if you're curious, Sonoma Partners could help Microsoft Dynamics CRM customers setup a similar integration with MDR data!

Please contact us if you're interested in learning more about our experience integrating MDR data into your CRM system.

Topics: Microsoft Dynamics 365 Microsoft Dynamics CRM Salesforce

Salesforce Made Smarter with Einstein

Today's blog post was written by Troy Oliveira, Principal Developer at Sonoma Partners.

Unless you have been living under a rock, you know that the big announcement out of Dreamforce this year was Salesforce Einstein, Salesforce’s Artificial Intelligence (AI) engine. But you probably have also spent some time wondering what the announcement means for your business and your day-to-day interaction with the platform. 

A common sentiment we hear is, “Einstein sounds great, but what does it really mean for me?” The answer to that it is as complex as AI itself. In short, I try to tell folks that this is an investment in the platform, and as with any investment, it is likely going to take some time for everyone to see the benefits. Some will see immediate benefits, while others will be waiting for awhile as Einstein becomes more widespread.

One thing is for certain: AI is the future, and Salesforce is committed to bringing AI into your business processes.

Making Salesforce the World’s Smartest CRM

The world is creating and storing new information at an astounding rate, and the amount of data that we are creating keeps rising on a day-by-day, hour-by-hour basis. For most of us, the question isn’t about not having enough information to make decisions, it is the exact opposite. We are flooded with too much information and cannot tell what is important and what is just white noise. That is where Einstein comes in.

Salesforce loves to use the following equation to describe how Einstein works and what it means to you.

Customer Data + AI + Salesforce Platform = World’s Smartest CRM.

Troy einstein 1

Through a combination of predictive analytics, machine learning, and natural language processing, Salesforce is able to comb through the data already in your Salesforce ecosphere and give you a better glimpse into what that data means as well as make suggestions and predictions on how you can act upon it.

As a salesperson, imagine the possibilities if you could focus your efforts on pursuing the best leads - not by guessing, but by using AI lead scoring to tell you based on what has actually happened in the past who the best leads are for your business.  Or a Marketer who can now segment their audiences by predictive open rating and send emails to every recipient at the exact right time.  Or a Customer Service Representative who is automatically prompted by case resolution steps and recommended responses?  This is the power of AI in CRM and that is what Einstein brings to Salesforce.

What does that mean for me, right here, right now?

This all sounds great, but what does it really mean for you today?

First, if your company or organization is using Salesforce Classic, you’ll want to consider moving towards Salesforce Lightning Experience. As with a lot of the new, shiny features that Salesforce has been releasing and will continue to release, the biggest benefit from Einstein is going to be found by those who are using Lightning Experience.

Second, since Einstein is machine learning and predictive analysis of YOUR data, the more data you have in Salesforce, the more accurate the predictions will be, and they will improve as you get more data into the system. That’s why it is called machine learning. The benefit to this is that your organization has predictions that are specific to you, not some generic model developed in a basement somewhere. The downside is that if you have bad data, you’re going to get bad predictions.

Lastly, keep an eye out for the future. At Dreamforce, only 17 Einstein features were announced, but we expect that number to grow tremendously over time. Meaning, if there isn’t something that you are interested in today, that doesn’t mean that Einstein isn’t right for you. Start taking the steps above to improve your data and work toward moving in the Lightning Experience direction because you never know what is coming in new releases.

How can I be a better consumer?

Keep an eye out for more information. I’ve linked to a number of blog posts that go deeper into how Einstein works and what it means for the different Salesforce clouds. Obviously this post isn’t meant to be the definitive source of information on Einstein, but we hope it can serve as a stepping-off point.

If you have any questions about Salesforce Einstein, Lightning Experience, or need help implementing your solution with Salesforce, please contact us.

Topics: Salesforce

You Gotta Know the Territory: Part 3

Today's blog post was written by Troy Oliveira, Principal Developer at Sonoma Partners.

So far, we've taken a look at Account Teams and Enterprise Territory Management in the previous posts in this series. The final post in this series is a short one, but don’t let the length of this post fool you; custom solutions are incredibly powerful options for solving complex territory management problems.

Custom Solutions

If neither Account Teams nor Enterprise Territory Management provides the solution that your company needs in order to handle your sales model, a custom solution might be your best option. We have successfully implemented several different options when it comes to creating an efficient custom solution for solving some very complex scenarios.

The biggest benefit of a custom solution is that most of the restrictions around the structure and automation of a model can be accounted for, typically through a combination of custom Apex code, Workflows, and Processes. Even better is that because all of the underlying information for Account Teams and Enterprise Territory Management can be queried in code, a fully automated hybrid solution could be created using one of the already existing territory modeling tools already mentioned. A great example of this can be found in this post by a colleague. It is also prudent to keep in mind that Enterprise Territory Management rules cannot be re-evaluated from code; any changes requiring the rules to be re-evaluated would require manually clicking “Run Assignment Rules” in the Salesforce UI.

While the custom solution option is a great way to tick off boxes in your organization’s requirements, keep in mind that you are still dealing with custom code. Since we fully recognize that territory models are fluid and change periodically, when we build a custom solution for our customers, Sonoma Partners takes great lengths to ensure that as much of the solution is configurable as possible. This helps reduce the need for someone to have to update and deploy code whenever changes occur to the territory model.

In Summary

If you’ve been following this series, you know what’s next. Pros and cons!

Pros: Cons:
  • Can handle more complex rules
  • Not native, needs to be tested with every upgrade
  • Automated processing
  • Requires understanding of coding
  • Can be combined with native functionality
  • Some functionality may be limited

Now that you’ve gotten a better idea of what territory management options are available to your organization, you can ensure that your salespeople know the territory.

If you have any questions about territory management or need help implementing your solution with Salesforce, please contact us.

Topics: Salesforce

Redefining a 360-Degree View of Your Customer

Today's blog post was written by Kyle Dreyer, Principal Architect at Sonoma Partners.

The genesis of nearly all CRM implementations comes from the desire to see a 360° view of your customers.

This typically involves the desire to see Contacts, Opportunities, Cases, Orders, etc. for an individual customer in an intuitive user interface. This provides a sales organization and customer service organization (as well as other business groups) insight into all activities around a customer. It is not difficult to realize the value that this brings.

The question now becomes – how do we take that to the next level? We are consistently hearing from our clients that they expect to have visibility from their account hierarchy to the data that resides within child accounts.

Imagine the following scenario of a customer hierarchy:

Kyle d 1

It is easy to see the logic that users would want to see Opportunity/Cases/etc. that reside in Division 1 and 2. Additionally, at the Holding Company level, users want to see everything that is occurring at Company A, B, and C – as well as what is occurring at each division.

So, how do we do this? This would, in theory, be possible with native reporting, but reporting across an inconsistent hierarchy (it won’t always be as simple as the example shown above!) can be challenging in reports. Additionally, you would either need to create a report for each account or provide the ability to change the parameter that the report is using (which, in the Salesforce world, would also give users additional reporting access that is not always ideal!). Lastly, users will want to see this data on the account record that they are currently working on.

Build Steps

The good news is that all of this can accomplished relatively easily using configuration. Let’s take a look at how to do this in Salesforce (for this illustration, I’ll show this capability on an Opportunity):

1. Create Account Record Types

Kyle d 2

*In this example, I’ve created generic record type names. More descriptive ones may be appropriate.

2. Create fields on the Opportunity object called “Parent Account” and “Ultimate Parent Account”

Kyle d 3

3. Create an Account Page Layout for Each Record Type

Kyle d 4

4. Map Account Page Layouts to appropriate Account Record Types

Kyle d 5

5. Add the appropriate Opportunity Related List to each Account Page Layout

Kyle d 6

*The above related list should be placed on the “Account Layout”

Kyle d 7

*The above related list should be placed on the “Parent Layout”

Kyle d 8

*The above related list should be placed on the “Ultimate Parent Layout”

6. Make Parent Account and Ultimate Parent Account Read only on Opportunity Page Layout(s)

Kyle d 9

7. Use Process Builder to auto-populate the Parent Account and Ultimate Parent Account when an Opportunity is created

Kyle d 10

Kyle d 11

Kyle d 12

Kyle d 13


  • Parent Account:
    • IF([Opportunity].Account.RecordType.Name = 'Grandparent', [Opportunity].Account.Id, IF([Opportunity].Account.RecordType.Name = 'Parent', [Opportunity].Account.Id, [Opportunity].Account.ParentId))
  • Ultimate Parent Account:
    • IF([Opportunity].Account.RecordType.Name = 'Grandparent', [Opportunity].Account.Id, IF([Opportunity].Account.RecordType.Name = 'Parent', [Opportunity].Account.ParentId, [Opportunity].Account.Parent.ParentId))
  • Activate the Process Builder and test it out!


In order to test this process, I’ve built out the account hierarchy in our previous example.

Kyle d 14

I created an opportunity on the Account “Division 1”, “Customer C”, “Customer B” and the “Holding Company” – lets check out the results by viewing the pages of these accounts.

Holding Company:

Kyle d 15

Customer B:

Kyle d 16

Customer C:

Kyle d 17

Division 1:

Kyle d 18

Additionally, the opportunity on Division 1 should “roll-up” to Company A (I’ve already shown this rolling up to the Holding Company) since its parent account is Company A. Let’s take a look at that account:

Kyle d 19

Requirements/Other Considerations

Now that we’ve shown how this functionality would work, I should mention a few considerations/requirements:

  • Define the maximum depth of the hierarchy.
    1. In this example, I’ve shown a 3-level hierarchy. There is no requirement to the depth that the hierarchy needs to be. That said, a maximum depth must be set. The greater the depth, the more complicated this becomes. I would encourage you to limit the hierarchy to 4 levels deep.
  • This is a simplified example.
    1. You’ll notice that the formula in the process builder is pretty straightforward. This design would allow for more complicated scenarios to determine the Parent and Ultimate Parent accounts on the Opportunities.
  • This is extendable to more child objects to an account – or any objects with a hierarchy.
  • Do not extend this to all objects related to an account.
    1. This design is not suitable for all objects. For example, we rarely (if ever) do this for Contacts. Often times, the number of contacts in the system would be overwhelming (and thus reduce the value) at the highest level in the hierarchy.


I hope that helps your organization consider the value of re-defining a 360° view of a customer. Our clients have found this to be instrumental to the way that they operate their business. You can imagine the benefit of “rolling up” certain objects (who doesn’t want to know the total dollars from orders that they do with a customer?). As always, should you have any questions, please do not hesitate to contact us!

Topics: Salesforce

You Gotta Know the Territory: Part 2

Today's blog post was written by Troy Oliveira, Principal Developer at Sonoma Partners.

In part 1 of this series, we briefly discussed the need for territory management and discussed how account teams could be a simple solution for solving your organization’s needs. But what if you’re looking for a solution that is a little more automated? A little more robust? Enterprise Territory Management might be the solution that you are looking for.

Enterprise Territory Management

If account teams were simplistic, Enterprise Territory Management falls on the exact opposite end of the spectrum.

Enterprise Territory Management is an incredibly powerful rule-based engine that allows for multi-level territory assignment that allows for companies to set up a highly structured model for assigning accounts to one or more territories.

Enterprise Territory Management (ETM) has several moving parts and can be daunting. The core components of ETM include the Model itself, Territories & Account Assignment Rules.

The Model

When setting up a territory model, the world is your oyster. First and foremost, the model is a hierarchy that can be utilized to describe relationships between the territories. Organizations are free to structure this hierarchy however they want; it can be flat with all territories on the same level or it can been very tiered breaking down territories into very specific segments. There is an overall maximum of 1,000 territories in the model, but that is the only system limitation. If your organization needs a model with more than 1,000 territories in the model, I would argue the model may need to be revisited to determine whether it is practical from a complexity and maintenance perspective.

Troy territory pt 2 1

Troy territory pt 2 2


Territories are the bridges that are used by the model for building out the relationship between accounts and user. Territories can be established in a manner that allows them to be completely isolated or, like the model itself, to be configured to inherit assignment rules from territories above them in the hierarchy.

Users are assigned to territories. Much like account teams, you can define roles for territory users. The users assigned will be granted the increased permissions to all accounts that are associated to the territory.

Troy territory pt 2 3

Account Assignment Rules

If territories are the bridge that relates accounts to users, Account Assignment Rules are the nuts and bolts that assemble the bridge and give it shape. Account Assignment Rules are filters that are applied against account data to determine which accounts should be selected as part of territory. The structure of these rules is very similar to the filtering used for List Views, Reports, and Workflows/Processes.

Troy territory pt 2 4

The assignment rules are then associated to territories. There are a couple things to keep in mind when thinking about associating assignment rules to territories. First, territories are not required to have an assignment rule; there might be territories in the hierarchy that merely show overall relationship or organization structure. Second, when multiple assignment rules are assigned to a territory, both rules need to evaluate as “true” for an account to be assigned to that territory. Last, depending on how extensive your model is, there may be scenarios in which accounts can be assigned to multiple territories.

How It All Works

Once a territory has been defined and activated, the administrator will need to initiate an initial assignment for accounts that already exist in the system (“Run Rules”). We recommend performing this initial assignment during non-business hours as Salesforce performs a great deal of heavy lifting generating the appropriate sharing rules to associate the accounts > territories > users.

Troy territory pt 2 5

As soon as the model is active, any new accounts will automatically be assigned to the appropriate territories. By default, once the account is assigned to territories, the relationship is set until the rules are manually run again. If your organization's territory model and assignment rules are set up in a way that requires accounts to move to different territories as data changes, that is possible with a little bit of configuration.

Troy territory pt 2 6

On each account page layout, you have the ability to configure the account to re-evaluate the assignment rules.  As an additional level of configurability, there is an additional option that is made available on accounts that allow users to signify that specific accounts should be exempt from re-evaluations of assignment rules.  This can be particularly helpful when there is potential that an account could change territories when there is an opportunity in progress so that the team working the opportunity can continue working it without fear that the account will be re-assigned.

Troy territory pt 2 7

Troy territory pt 2 8

Just like with account teams, Salesforce also provides the ability to filter the My Accounts to filter on "My Territories Accounts."   Similar to account teams, these filters are also available when building reports.

Troy territory pt 2 9

As with everything, there are some limitations involved with Enterprise Territory Management. The most common of these involves the definition of account assignment rules and fall into the realm of “practical” limitations. For example, if your model involves defining territories at a postal code level, there are limitations to the size of the account assignment rules that cause problems when trying to handle all possible postal codes. 

In Summary

Wow, a lot of detail here.  Let’s look at a condensed pros/cons list:

Pros: Cons:
  • Simple, native implementation
  • Limited to 1,000 territories
  • Point-and-click setup
  • Limits on assignment rule filter length
  • “My Territories Accounts” in filters and reporting
  • Does not always play well with bulk record processing
  • Territories automatically assigned on Account creation (can be re-evaluated on update)
  • A lot of overhead when running assignment rules

Now that we’ve looked at account teams and Enterprise Territory Management, what if neither option is 100% what you need for your organization?  Next time, we’ll take a look at custom solutions for territory management.

If you have any questions about Enterprise Territory Management or need help implementing your solution with Salesforce, please contact us.

Topics: Salesforce

Are You Lightning Ready?

Today's blog post was written by Nathen Drees, Senior Developer at Sonoma Partners.

Lightning ready

A year ago, Salesforce announced a new UI in Salesforce - Lightning Experience - aimed at rebuilding the desktop interfaces to provide streamlined access to the information sales reps most common uses. Since that time, Salesforce has continued to put significant effort into Lightning Experience, regularly adding updates and bug fixes to bring the UI in to feature parody with Classic. With the latest release (Winter ’17), the bulk of the features are now available in Lightning, and we expect the rest to be added very shortly.

Due to this influx of development and marketing efforts, we at Sonoma are seeing a majority of our new clients, and even some of our existing clients, embracing Lightning Experience as the standard UI they run their business on, and we expect that trend to both continue and intensify as time goes on. Extrapolating this trend into the future, it would seem we’re nearing a tipping point where more businesses will be using Lightning Experience as their default UI rather than Classic, which leads us to one question for our App Innovator partners: are you Lightning ready?

Riding the Lightning

Lightning ready 2Shortly after Lightning Experience was announced, Salesforce put in place a program for App Innovators to certify that their apps would work in Lightning Experience, and assisted them with marketing by adding a Lightning Ready sash to their AppExchange listing. While the requirements for being Lightning Ready has and continues to evolve, the core concept remains the same: make sure your app is seamless with Lightning Experience. Complicating matters is the fact that Lightning Experience continues to evolve as Salesforce updates it to support more features, meaning that you need to stay up to date with each release and ensure your app continues to work going forward.

You Can Do It, We Can Help

While this task may seem daunting at first, it doesn’t need to be, and we can help. We at Sonoma Partners have an in-house development and technical staff that can review your app for Lightning Compatibility at the code level, business analysts who know Lightning Experience from a configuration and reporting perspective, and QA staff who can ensure your app integrates seamlessly from an end users point of view. Should we find anything, the same staff can assist in gap analysis, any development or configuration needed to close the gaps, and end-to-end testing to ensure you pass your review with Salesforce the first time, with as little fuss as possible. We have experience working with App Innovators and know the business and the Salesforce security review process.

Need help determining if your app is Lightning ready? Just want a second set of eyes on it before you go in to the review with Salesforce? Want to talk about something totally unrelated? Contact us, and we can help.

Topics: Salesforce

You Gotta Know the Territory: Part 1

Today's blog post was written by Troy Oliveira, Principal Developer at Sonoma Partners.

When I was a child, one of my first exposures to the genre of Broadway theatre was The Music Man, in which a brash salesman named Harold Hill was beguiled by the traveling salesman community for not knowing the territory. His story is not unlike that of many salespeople in companies everywhere.  He would roll into town (a prospect) and sell what he could, not fully understanding what he was selling and when he was done, he moved on to the next town. His selling strategy involved getting in and getting out - once he closed the deal, the customer was left on their own to figure things out. There was no hope or even attempt at repeat business or customer follow-up.

Given that you’re reading this post, I can only assume that you have figured out by now that this model of sales is not sustainable and that building a relationship with your customers is an important part of your daily business and sales practices.

One of the components that we help our customers wrestle with in almost every customer engagement is around the idea of territory management.

Very quickly we learn that everyone puts different meaning to the concept of territories, ranging from the strict rules to "parlay" (…more of a guideline, really). Some have singular salespeople as the overseer of the accounts in a territory while others work in teams or have multiple product lines that service the same territory. The good news is that the Salesforce platform provides some really flexible options for being able to manage territories, and lucky for you, that’s the topic of this post.

Sharing is Caring

In this series of posts, I will walk you through some of the high level features, benefits, and drawbacks of the three territory management methods that we work with on a daily basis: account teams, Enterprise Territory Management, and custom solutions.

Account Teams

If we start with the premise that every user has the ability to see every account, and we have multiple people who need to be able to work the account and make necessary updates, create opportunities, etc., account teams are by far the easiest form of territory management that Salesforce provides. 

From a bare-bones perspective, account teams are a list of users who are added on as an ad-hoc basis to each account and as a result, are extended additional permissions for the account and related objects.

Troy territory 1

Don’t let the simplicity of account teams fool you - they are an incredibly powerful tool for extending permissions to accounts and extend abilities that would normally only be available for account owners. Account teams also provide your users flexibility in creating account views. Instead of only having access to “My Accounts," they now have access to filters based on “My Account Teams Accounts,” allowing users to see a list of all accounts which they “own” by being part of the team. This functionality also extends to reporting.

Troy territory 2

Account teams become even more powerful when combined with the concept of default account teams.  Default account teams can be set up at a user level and when an account is assigned to a user, their default team is automatically added to the account. For example, as a customer relationship manager, I have a set of account managers and sales reps that I work with on all of my accounts, I can setup my default account team to include those users and when an account is assigned to me, my team automatically gains access to the account.

Troy territory 3

Beyond simply providing access, account teams also provide the ability to define the user’s role on the account. Account team roles are a great way of distinguishing what the user does for an account. For example, in my scenario of wanting to talk to sales reps who are selling a product that I am having trouble selling, I can quickly determine who the sales rep is for an account that recently purchased the product by looking at the account team and finding how who is in the sales rep role. Another great example of using roles for account team members is when your company has multiple business lines. Organizations can set up a role for each business line and by notating who the salesperson is in each business line, you can provide feedback for purposes of cross-selling when you hear that the customer is interested in a product that falls outside of your business line.

If it sounds too good to be true, it might be. Because this is the most simplistic option for managing shared ownership, there are some restrictions. The very base component of account teams is around providing access, not determining how the account teams are assigned. The overall process of adding account team members is manual and ad-hoc. Even when using default account teams, you will still need another process in place to handle the initial assignment.

Another potential pitfall with account teams is that when the teams are shown on the page layout, anyone who has access to edit the account also has the ability to add users to the account team, though they do not have the ability to extend access levels. This can be specifically problematic when your organization has gone to great lengths to build workflows and processes to ensure that specific people are added to specific account teams. Ultimately, this leads to a discussion around removing visibility into account teams which reduces transparency.

In Summary

That’s a lot of information about account teams. Let me distill it down into some simple pro/con lists.

Pros: Cons:
  • Simple, native implementation
  • Manual process
  • Point-and-click setup
  • No relationships
  • Quickly add team members to accounts
  • Account team members can add new team members
  • "My Account Teams" in filters and reporting
  • Default teams for record owner

Next up in this series is enterprise territory management.

If you have any questions about account teams or need help implementing your solution with Salesforce, please contact us.

Topics: Salesforce