Sonoma Partners Microsoft CRM and Salesforce Blog

CRM 2013 Form Behavior

Today’s guest blogger is Kris Pasterick, a Consultant at Sonoma Partners.

Recently, I came across some interesting behavior with Sub Grids and Option Sets in CRM 2013. The Sub Grid behavior is affected by the Field Requirement of the associated lookup fields. The length of an Option Set’s drop down is relative to the number of rows below it in a section. In order to explain the behavior, I have set up a simple scenario.

Sub Grids

I created a custom entity called Role whose purpose is to track a Contact’s role at an Account. I created two lookup relationships from Role, one to Account and another to Contact. When I initially set this up, I created the lookup to Account as Business Required. However, I mistakenly left the Field Requirement on the lookup to Contact as Optional. While this certainly has an effect to the form for Role, it also affected the Role Sub Grids that I added to the Account and Contact forms.

On the Account form, the Role Sub Grid behaved exactly how I expected. Clicking on the plus (+) icon, pops open a new Role form with the Account filled in.



However, from the Contact form, if I click on the plus icon, a new Role form does not pop open, but rather a lookup field shows up in the grid.



The purpose of this lookup is to find that Role record to which you want to relate to this Contact. However, I wanted the same behavior as I had from the Account form. In order to fix this issue, I went back to the Contact lookup field and set the Field Requirement to Business Required. Once I published the changes, I started seeing a new Role form pop up when clicking the plus icon.

Option Sets

With this same Role entity, I had setup an option set field as the last field in a section, and when a user would click it to select a value, only three rows would display.


Elsewhere in the application that I was building, I noticed that a different Option Set would display more rows of options. What was different between these two Option Sets was that the other one was not in the last row of fields in its section. So I decided to add Spacers below the Option Set field. As I added more Spacers, more of the rows in the Option Set displayed. Through trial and error I found that the largest that an Option Set would appear was when there were 5 or more spacers or fields below the Option set within the same section.


So, if you want a larger Option Set drop down, add more rows below the Option Set in that section.

CRM 2013 Custom Actions - The End of Configuration Entities

CRM 2013 adds a new handy feature called Custom Actions.  Custom Actions provide the ability for non-developer administrators to write reusable modules of logic that developers can trigger through client-side or server-side code.  Custom Actions are built using a similar UI as workflows with the same capabilities.  The actions are run synchronously and can take in parameters as well as return values.  Custom Actions can be pretty powerful and are a great way to share logic between both JavaScript and plugins.  Below is a great example we came up with to show how we can replace a 2011 style configuration entity with 2013 Custom Actions. 

In CRM 2011, if you need to reference values in code that would change between deployments, the best practice is to create a new entity (typically called Configuration) and add necessary attributes for configurable values such as a “Server URL” of an integration web service.  The sole purpose of this entity is to hold one record that would contain the correct values that your custom code can reference, usually for integration purposes.  The downside to this approach is that it adds overhead by needing to create a whole entity that will only ever have one record and you need to manually import that record into your target environment.  Below is a step-by-step guide on how we can avoid a configuration entity in CRM 2013 using Custom Actions.

In CRM 2013, go to Settings and then Processes.  Create a new Process and set the Category to “Action” and the Entity to “None (global)”.


Once the process is created, click the plus icon to add a new argument and set the name to the configuration value such as “ServerUrl”.  Set the Type appropriately based on your value and set the Direction to Output.  Do this for each configuration value needed.


Scroll down to the designer and click “Add Step” and then “Assign Value”.


Click Properties and in the new dialog window, type in the value for your configuration attribute.image

Now save and activate your new custom action.

The custom action is now live so we can use the CrmSvcUtil to generate an SDK message for the action so that we can easily use it with server-side code.  You can use the CrmSvcUtil the same way in 2013 as you did in 2011 but you will need to add the “/a” flag to generate an SDK message for your custom actions.

Note:  You will need the latest CrmSvcUtil which is provided here in the 2013 SDK.

CrmSvcUtil /url:http://server/org/XRMServices/2011/Organization.svc /out:Demo.cs
/serviceContextName:DemoContext /namespace:Demo.Model /a

Now we can reference the new_GetConfigurationValuesRequest and execute it to get the ServerUrl value from CRM.  Even though we specified the custom action as global, we are still required to pass in an EntityReference otherwise CRM will throw an error.  Our workaround for this is to pass in the ID of the current user. 

var request = 
     new new_GetConfigurationValuesRequest()
          Target = new EntityReference("systemuser", GetCurrentUserId()),

var response = (new_GetConfigurationValuesResponse)_service.Execute(request);
var url = response.ServerUrl;

So there you have it!  Executing this request returns “http://server” that I had set in the custom action and now we can use it to replace a configuration entity.  As you can see, custom actions can be pretty powerful.  One improvement we’re hoping for in the future is to allow custom actions to execute custom code, similar to a workflow assembly.  This would allow developers to easily kick off server-side code from JavaScript.

Topics: Microsoft Dynamics CRM 2011 Microsoft Dynamics CRM 2013

What is your enterprise mobile application 'Best At'?

Have you noticed a child using an app (usually a game) on a mobile device? Regardless of the device, my children (even as young as 2) have no trouble finding the games that interest them, understanding the device’s gestures and have yet to read a manual to play. They quickly become proficient at the applications that interest them. Part of the reason is the applications themselves are specific, use visual design techniques and contextual walkthroughs to guide the user (in this case my children).

multiple mobile device img

With the recent emphasis of enterprise mobility, many organizations are looking at how to best get started in this growing space. Some look to what devices they should support, others start with architecture and technical discussions or with what applications should be consumed on this new technology. I have found that the most impactful approach is to first ask the question 'what should my mobile application be best at'? Forgiving the fact I ended a sentence with a preposition, to me this question sums up where you should concentrate your initial effort, not on the technology, architecture or even device.

We take a targeted, user-intuitive approach with business applications. At Sonoma, we created an entire team specifically around user experience, design, and mobile development. Our team focuses on these guiding principles when addressing our enterprise mobile application projects:

  • Focus on a discrete use case
  • Understand your user and make the application relevant to them
  • Keep it simple
  • Design first
  • Reflect your organization’s brand

In order to distill the complexities of business processes to a series of screens or events suitable for a mobile device, we first start with the use case or user process we would like to enable. From there, we determine what does the application need to be ‘Best At’? Once this foundation is in place, we derive the solution architecture, device strategy and the remaining logistics to deliver an impactful mobile application to your users.


Are you not sure how to get started with enterprise mobility? Consider trying our Mobility Test Drive experience and let us help you find what your mobile application needs to be 'Best At'.

Topics: Enterprise Mobility

Universal Search is Now Updated for CRM 2013!

We are pleased to announce that our popular Universal Search solution is now CRM 2013 compatible!  This solution is free to use so head here for the download.


  • A new feature has been incorporated into the update!  You may now filter the amount of data returned based on Creation Date.

US - default date filter

  • Styling has been updated to fit with the new 2013 look and feel



If you have any additional issues or questions regarding Universal Search, please visit our Community Site Forum for Universal Search.

Topics: Microsoft Dynamics CRM 2011 Microsoft Dynamics CRM 2013