Sonoma Partners Microsoft CRM and Salesforce Blog

$Permission on the Salesforce Platform – Part 3

In part one of this series, we looked at how and why you would create custom permissions, and in part two we looked at how a developer could use them when writing Visualforce. In today’s post, we’ll be looking at how developers can use custom permissions when writing Apex code to control access and functionality inside triggers, web services, and Visualforce controllers.

Custom Permission

Under the hood, Salesforce stores custom permissions as Custom Permission records. When writing apex code, we need to query this table to determine what custom permissions exist, and then tie those records back to the user through the SetupEntityAccess and PermissionSetAssignment objects. To help visualize the hierarchy we need to traverse, we’ve created an ERD describing the relationship of the objects:


The important thing to understand here is that eventually every permission gets tracked through a PermissionSet record, even the permissions granted by profiles (API 25+). Using these objects, developers can write utility functions for determining what custom permissions a user or group of users have assigned to them, and act accordingly.

Wrap Up

Confused about custom permissions? Not sure how to access them from your code? Need a partner to help you navigate the configuration sea? Contact us and we can help.

Topics: Salesforce

$Permission on the Salesforce Platform – Part 2

In part one of this series, we looked at how and why you would create custom permissions. Now that we have a custom permission created, we’re going to look at how a developer can use them when writing a Visualforce page to control the functionality of the page.

The $Permission global variable

Along with the release of custom permissions, Salesforce also released a new global merge variable for Visualforce called $Permission. The new merge variable contains boolean values indicating if the current user has a given custom permission.

Using our Manage VIP Status custom permission we built in part one, we can build a very simple Visualforce page which just prints out if the current user has the custom permission or not:

When the user does not have the custom permission assigned to them, the page displays:


However, when the custom permission is assigned to the user, the page displays:


As you can see, it is very easy for developers to leverage custom permissions when building Visualforce pages to control access and functionality at a more granular level.

In part 3 of this series, we will look at how developers can access custom permissions from Apex code to control access inside triggers, web services and Visualforce controllers.

Wrap Up

Confused about the new merge variable? Not sure what merge variables are? Something else on your mind? Contact us and we can help.

Topics: Salesforce

Unsupported Customizations in CRM 2015

Microsoft has been rolling out CRM 2015 for Online organizations (On-prem download can be found here) but before you perform the update you will want to review the new list of unsupported customizations in 2015 to see if you are currently using any of them.

Earlier in the year, in the 2013 SDK, Microsoft provided a list of things that will be changing in the next release which can also be found here in the MSDN.  Only 3 functions are being removed, getServerUrl (use getClientUrl), isOutlookClient (use client.getClient) and isOutlookClientOnline (use client.getClientState).  The Xrm.Page.ui.getFormType call will no longer return 5 for Quick Create and 11 for Read Optimized as those types of forms were removed/deprecated in earlier releases.  Also be sure that your customizations are no longer using the old 2007 endpoint as it is removed in CRM 2015.  To help detect if you are using the 2007 endpoint, you can run the Legacy Feature Check tool against your organizations.

Lastly, there have been some changes to the web application requirements for CRM 2015.  Support for IE8 and IE9 has been removed with the new version.  See below for a list of all the supported browsers:

  • Internet Explorer 10
  • Internet Explorer 11
  • Mozilla Firefox (latest publicly released version) running on Windows 8.1 or Windows 8, or Windows 7
  • Google Chrome (latest publicly released version) running on Windows 8.1 or Windows 8, or Windows 7, or Google Nexus 10 tablet
  • Apple Safari (latest publicly released version) running on Mac OS X 10.8 (Mountain Lion), 10.9 (Mavericks), or Apple iPad

And the supported versions of Microsoft Office:

  • Microsoft Office 365
  • Microsoft Office 2010
  • Microsoft Office 2013

As always be sure to perform the upgrade first in a development or sandbox org to verify that your customizations are still functioning post-upgrade before upgrading your production environment.

Topics: Microsoft Dynamics CRM Microsoft Dynamics CRM 2015 Microsoft Dynamics CRM Online

Make Your Visualforce Components More Useful

Today's post is written by Andrew Monshizadeh, an iOS Developer at Sonoma Partners.

As consultants, we are often asked to provide fully customized solutions for our clients' needs. This can range from basic customization via the Setup interface (Point & Click Customization) to creating entirely new experiences on top of the platform. Often though, we are found somewhere in the middle and need to create simpler Visualforce pages, and backing Apex controller/extensions, to simplify some processes for the client.

When developing Visualforce pages, there comes a point where it feels like sections are starting to be repeated. In development, there is a principle called "Don't Repeat Yourself" (DRY) that says if there is code being repeated, the developer needs to rewrite that code into a reusable component. The DRY'er the code, the easier it should be to maintain and understand. Thankfully, the platform provides this functionality for Visualforce -- Visualforce Components.

Visualforce Components are little (or big) snippets of Visualforce that can be reused across numerous Visualforce pages, or multiple times in a single page. These components, then encapsulate whatever reusable visual and logical elements necessary to be self-containing. Additionally, a Visualforce Component can have a backing Apex controller class. With that backing controller, the component can do additional processing necessary for itself, without relying on the parent page's controller.

As an example of where this can be helpful, consider the situation where a client wants to display a table of Case records relating to a given Account. Normally, the developer would just put an <apex:relatedList> tag in there, and call it good. 
Figure 1: What a standard related list would look like

However, what if the client wants some dynamically generated content in that table, like the most recent Case Comment inline with the Case Number? This is not so simple.

The most common solution would be to use an <apex:pageBlockTable> tag, pass in a list of Cases, and create a Map of Case ID to Case Comment Body in the page's Apex Controller. However, this potentially breaks the concept of DRY code if there is even another situation where the client wants to use this list of Cases and Case Comments because all of the logic and view is tied into this one Visualforce page. In order to reuse this Case list, the developer would have to copy/paste the Visualforce and Apex into another page and controller.
Figure 2: Custom page block table

A better solution would be to move the <apex:pageBlockTable> tag, along with the Case and Case Comment Apex code out into a Visualforce Component and backing Apex Controller. With a properly developed component, it is extremely simple to add this Case and Case Comment list to any page that needs to display this information.

In the second part of this post, we will discuss the process of building this example component.

Have questions about Visualforce Components? Let's set up a time to talk.

Topics: Salesforce

The Salesforce Admin’s Toolbox: Embed a Flow in a Custom Button


The Salesforce Admin's Toolbox is written by Megan Burch, a Salesforce Business Analyst at Sonoma Partners.

Salesforce is a powerful platform and it’s incredible to see what administrators can do without custom code or development. But what many Salesforce admins don’t realize is that they can solve many complex scenarios with a just a little bit of code and configuration, without the assistance of a developer.

The Salesforce Admin’s Toolbox is a series designed to showcase a variety of technical tasks that admins can do to elevate their Salesforce solution. I’m here to empower the admin and show you how to accomplish things you once believed could only be done by a developer.

Visual workflows allow admins to construct complex scenarios with forms and business processes. What becomes a little tricky, is providing users an easy way to access the flow within Salesforce.  Users access these flows directly from a URL, through a custom web tab, or a custom button. Personally, I like using custom buttons to access the flow because the user can run it directly from the record they’re viewing.  This approach may appear a bit intimidating because in addition to creating the custom button, you first have to embed the flow in a Visualforce page. But as you will see, this is really not as hard as it sounds if you follow these steps. 

1. Create a new Visualforce Page
This can be done by navigating to Setup > Develop > Pages then clicking “New”

2. Embed your flow
Every new Visualforce page starts out looking like this 


Remove the existing code.

For line 1, type the following:

<apex:page standardController="Contact" tabStyle="Contact" >›

The <apex:page /> tag is the command to create the page.

Note you’ll set the style of the page based on the object where you want the button to appear. In this case we’re going to put it on the Contact page. If you’re using this on another object, just substitute the name in line 1, if you’re using a custom object, append __c at the end for the standardController and tabStyle values. 

The second line of your page will call the flow using a component. The component for calling a flow is simply <flow:interview /> with a name filled out.

On the second line, use the following:

<flow:interview name="Call_Script"></flow:interview>

Note: The name must be the unique name you created in Salesforce, so underscores will be used between words. If you’re not sure what the unique name of your flow is, navigate back to the flow you created and locate the unique name on the top right.


The last line will just be the closing page tag, so overall you’re page will look like this:

<apex:page standardController="Contact" tabStyle="Contact" >

         <flow:interview name="Call_Script"></flow:interview>


We have just created a custom VisualForce page! Next we need to create the custom button that will access our new page.

3. Create a Custom Button
To create a custom button navigate to the “Button, Links, and Actions” option from the object you want to create the button. For your example, we will use the Contact object.

The first thing you’ll want to set is the display type. 

A “Detail Page Link” button will show up next to the custom links on the detail page. 


A “List Button” will show up on any related lists or list view you choose to put it on. 


For this example, I chose a “Detail Page Button”. This means the custom button will show up at the top of the record along with the standard Salesforce buttons.

Next, choose your behavior. This just gives you an option of how you want the flow to open. As you can guess, the Display in new window option opens the page in a new window. 

Display in existing window with sidebar will run the flow in the same window you were in, showing the Salesforce sidebar. 

Display in existing window without sidebar will run the flow in the same window you were in, without showing the Salesforce sidebar. 

Display in existing window without sidebar or header will run the flow in the same window you were in, without showing the Salesforce sidebar or standard header. 

Execute JavaScript will execute any JavaScript written in your organization that is set to run items upon click.

Again for this example, I chose Display in new window. I chose this behavior so the user could run the flow without losing visibility of the contact record they were on previously.Finally, you’ll want to select your content source, which in this case is Visualforce page.

In the Content drop down, you’ll see a list of all the Visualforce pages in your organization. Pick the page you just created and save.

4. Adding a Custom Button to a Page Layout
To add your custom button, navigate to the edit page layout screen. Select the “Buttons” option from the sidebar, and drag your button onto the page.

Users will now be able to launch the custom flow without leaving the record, which is a huge win over the custom URL solution.



Topics: Salesforce

$Permission on the Salesforce Platform – Part 1

Salesforce comes with an extensive security model built in that can handle many different scenarios, from controlling access to data and functionality, to guiding data through different flows and business processes. However, no security model, no matter how extensive, can possibly cover every need of every business and still be useable. To account for this, Salesforce added custom permissions in Winter ‘15 to allow administrators and developers to extend the security model to meet their needs. In the following posts, we will be looking at use cases for custom permissions, as well as how to create them and use them.

A use case for custom permissions

Let’s assume we work at a company where Accounts can become “VIP” accounts. The rule is that there is one person at the company in charge of maintaining who the VIP accounts are. This person could potentially be anyone. Our company would like the ability to change who the VIP manager is as needed. How would we accomplish this?

One solution is to add a checkbox to the User record that tracks if the user is a VIP manager or not. This works, but there are a few draw backs. The first is that to maintain who is a VIP manager, you need to go in to each user record and update the bit field accordingly. For a large company that has many potential VIP managers, this can become time consuming and error prone. The second main problem is that this architecture isn’t semantic about what the bit field is actually doing. What this option really represents is the ability (read: permission) of the User to elevate and demote Accounts to VIP status.

With Winter ’15, we now have the ability to create and assign custom permissions. Once created, custom permissions can then be leveraged by developers while they’re writing code to enforce that certain functionality or behavior is only available to people with or without the permission.

The advantages of custom permissions are twofold. To start, they can be included in Permission Sets to bulk apply it to your users, as well as associated with profiles so that any user with the profile automatically gets the custom permission assigned to them. Secondly, they’re more semantic about what they’re doing. It’s clear that they’re granting someone access to do something instead of just providing data about the user.

Creating a custom permission

To create a custom permission, navigate to Setup > Develop > Custom Permissions and click the New button. 


On the following screen, give the custom permission a Label and Name (the name is used by developers when referencing the permission in code). You can optionally give a description of the permission, and relate it to a Connected Application if applicable.


After clicking save, your new permission is created and available for use in code.

In part 2 of this series, we’ll look at how developers can use the custom permission when creating Visualforce pages to control how the page functions.

Wrap Up

Curious about custom permissions? Not sure when to use them? Just need someone to talk to? Contact us and we can help.

Topics: Salesforce

Salesforce Logins for Safari

Today's post is written by Andrew Monshizadeh, an iOS Developer at Sonoma Partners.

As a developer who primarily works on an Apple laptop, I recently upgraded to OS X Yosemite.

However, that brought with it a few problems - namely, my browser of choice (Chrome) updated to a version that broke compatibility with a few enterprise applications we use on a daily basis. To prevent having to switch between browsers constantly, I decided to move my entire workflow to Safari. 

I quickly ran into a roadblock though — with the number of Salesforce orgs I use numbering into the double digits, I am unable to remember all of those logins. On Chrome I used the wonderful Logins. Safari, however, did not have anything like that. Therefore, I decided to build it. 

My goal was never to completely reimplement Logins, but rather to learn about Safari Extensions by building out the most important and basic functions — store a list of login information with one click to login.  Using Bootstrap 3, I was able to create a simple interface that looks decent. Safari allows developers to create Extensions that take advantage of standard web technologies, like Local Storage or injected Javascript. Originally the extension used Local Storage, but that was potentially more insecure than we would have liked, so it was moved to a Secure Setting which is intended for things like passwords.

Overall this was a great experience learning the advantages, limitations, and potential for building Safari Extensions. If you would like to view the code, help make it better, or just use the extension, please head over to our github page and check it out!

Topics: Salesforce

Poodle and your CRM

Today I am co-blogging with Blake Scarlavai, Development Principal and Microsoft Dynamics blogger at Sonoma Partners.


Recently a vulnerability in SSL 3.0 known as “Poodle” gained some significant attention, with many companies responding in various ways to ensure their customers’ data is protected. It can be confusing to keep track of what companies are doing what, and what is expected of you as a customer to ensure you are not vulnerable. Below are the summaries of the responses that Salesforce and Microsoft have taken.

Salesforce’s Response

Salesforce is in the process of disabling SSL 3.0 on their platform. By the end of December, you will no longer be able to use SSL 3.0 visit Salesforce’s platform. For the most part, we don’t expect this to affect our clients as the browsers which needed SSL 3.0 still enabled (IE 6 mainly) are already not supported by Salesforce. You can get the full list of the disable schedule and more information about the changes on Salesforce’s help page.


Microsoft’s Response

Microsoft is in the process of remediating their online services for the SSL 3.0 vulnerability.  Below is a time table for each of the CRM services:


SSL v3.0 Mitigation Status

Microsoft Dynamics  CRM Online


Microsoft Dynamics Marketing


Microsoft Social Listening


Parature for Microsoft Dynamics


Microsoft Dynamics Lifecycle Services


Online Services for Microsoft Dynamics



Microsoft also recommends disabling SSL 3.0 in your browser.  The following resources can be used for your respective browser:

For more information on Microsoft’s response, click here.

Topics: Microsoft Dynamics CRM Microsoft Dynamics CRM 2011 Microsoft Dynamics CRM 2013 Microsoft Dynamics CRM 2015 Microsoft Dynamics CRM Online Salesforce

Dynamics CRM 2015 is Released!

The much anticipated release of Dynamics CRM 2015 is here!  CRM 2015 is now available for download for on-premise.  CRM Online trials are going live with CRM 2015 as well, so head here to signup.

Curious to find out what is new in CRM 2015?  Head here to the Customer Center to see a list of new features in 2015.  In preparation for the release, we have also been covering the new features in detail:

Hit us up in the comments and let us know what you think of CRM 2015 as well as any topic you would like covered further!

Topics: Microsoft Dynamics CRM Microsoft Dynamics CRM 2015 Microsoft Dynamics CRM Online

Dynamics CRM 2015 Sales Module Enhancements

Microsoft recently announced new features coming out with their next version of Microsoft Dynamics CRM 2015 (previously code named Vega).  Check out the Dynamics CRM 2015 Release Preview Guide to see what features are coming with 2015. 

Next up for our review are the changes being made to the Sales Module.  The following list of enhancements are being made with CRM 2015 and we’ll dive into a few of them a little bit deeper:

  • Product Bundles
  • Cross Sell / Up Sell (via relationships between products)
  • Product Families
  • Territory Specific Default Price List
  • Import/Export Settings via the Configuration Migration Tool provided with Leo
  • Families/Products/Bundles all show up in one grid
  • Clone Families/Products/Bundles (field values and all current product property values – including overridden values).
  • Product Form Preview (displays the product properties so you can preview how it’d look when selling the products)
  • New System Settings Configuration Options
  • Override default pricing engine via code/SDK

Now lets dive a bit deeper into some of these features.


If you’ve used Product Kits in the past, you’ll be familiar with Product Bundles.  Bundles are an enhanced version of Product Kits (e.g., you cannot view Kit Items when selling a Kit, but you can with a Bundle – see the Opportunity screenshot below).  Product Kits will not be going away with CRM 2015, but instead Bundles will be an additional option users can use along with Kits.

Within a Bundle you can specify what Products are mandatory or not when selling the Bundle.  They can also be tied to Product Families (more information below) but are not required to be.  Finally, Products within Bundles have Properties that can be edited (e.g., what is the default value, is the property editable when being sold, etc.).


When adding the Bundle to an Opportunity, Quote, or Order, you’ll see the Bundle with the individual Products indented underneath.  You‘ll also have the availability to edit the properties of the Products in that bundle for the specific Opportunity, Quote, or Order you’re working with.


Cross Sell and Up Sell

As stated above, using a relationship between Products, you can define Cross Sell and Up Sell products.  This Product Relationships area is a sub-grid directly on the Product form.


When on an Opportunity, Quote or Order selling products, there will be a Suggestions Link that when clicked, will show the Cross Sell and Up Sell products that an administrator has defined for your organization.  The user can click on Pick and then Add to List to add the suggested product to their opportunity immediately.


Product Families

Product Families are another way to group products and create product hierarchies.  The Child Products in a Product Family inherit the properties of the Product Family when they’re added to the Product Family, but can be overridden.  Then, when adding the Product to an Opportunity, some of these properties can be modified by the Sales Person, while others may not be (defined in the Settings of the Product Family setup).  The properties can be Read Only, Required, or Hidden.

Product Families are similar to Bundles, but the user cannot add a Product Family to an Opportunity, Quote, or Order like they can with Bundles.  Instead, Product Families are used for administration of Products themselves.


New System Settings Configuration Options:

There are a handful of new System Setting Configuration Options coming with CRM 2015 that should be called out separately.  The following settings can be configured per CRM organization:

  • Indicate if the Default Price List is set via an inbuilt rule.  If this is set to yes, then the default price list will be selected for an opportunity based on the default price lists defined for territories.
  • Max # of Products in a Bundle
  • Use system pricing calculation (override default pricing) – customers can use the SDK to have a custom pricing engine built in
  • Discount calculation method:  Per Unit (new option) or Line Item (previous option)
  • Max # of Properties for a Product/Bundle


Some great new additions are being added to 2015 as you can see from above.  However, with these new enhancements, there are still a few limitations you should be aware of:

  • You cannot have bundles of bundles (only products are allowed to be added to bundles)
  • Only active / retired products can be imported/exported via the configuration migration tool
Topics: Microsoft Dynamics CRM Microsoft Dynamics CRM 2015 Microsoft Dynamics CRM Online