Tag Archives: Microsoft Dynamics CRM

Fix Incorrectly Created Status Reasons in Dynamics CRM

The Status Reason field in Dynamics CRM is a special field which allows you to provide reasons for the status of a particular record. For example, an Article can have a Status of “Active” and a Status Reason of “Awaiting Review”, “Approved”, “Published” etc. Likewise, an Article can have a Status of “Inactive” and a Status Reason of “Expired” or “Deleted”. But what happens if you configure your Status Reasons incorrectly?

I had recently made a mistake while configuring the Status Reason field such that a user could set an Article to Active – Deleted, which was not the desired functionality. The “Deleted” status reason should instead be linked to the “Inactive” state.

clip_image001

The CRM implementation also enforced strict rules so that the “Deleted” status reason must have an ordinal value of 213,940,003. Let’s see what happens when I try to simply re-create the “Deleted” status reason against the “Inactive” state.

If I try to delete and re-create the “Deleted” status reason, the CRM platform automatically assigns it the next available ordinal value of 213,940,006 and it appears that I cannot change this value.

clip_image002

Thankfully there is a way to change this value without any nasty database hacks.

Firstly, remove the “Deleted” status reason, save your changes and publish customizations. Next, add the “Deleted” status reason to the list of “Inactive” status’ as we previously attempted.

clip_image004

On the Add List Value screen, press F12 to launch Internet Explorer Developer tools.

clip_image002[1]

Make sure the HTML tab is selected and then select the cursor icon.

clip_image005

Back on the Add List Value screen, hover over the Value textbox so it appears with a blue outline and then click the mouse.

clip_image006

Back on the Internet Explorer Developer Tools screen, on the right-hand pane, select Attributes and then select the disabled attribute. Press the delete button to remove this attribute.

clip_image008

The Value field will now be editable. Change the value from 213,940,006 to 213,940,003 and then click on OK.

clip_image009

Save the changes to the Status Reason field and publish customisations. The “Deleted” status reason will now be available to select when making records inactive.

CRM 2013 Release Candidate – Fixed User Profile Images

I previously blogged about the new profile picture feature for user accounts in Dynamics CRM 2013. However, there was an issue with the beta preview where the image on the navigation bar was not updated to the photo you have uploaded.

clip_image001

Microsoft has just released the Release Candidate version of CRM 2013 which addresses this issue.. After setting your image, the placeholder image on the navigation bar is now updated.

clip_image002

Enjoy!

The Authentication Endpoint Kerberos was not found on the configured Secure Token Service

We recently setup an internet-facing deployment for Microsoft Dynamics CRM 2013 using ADFS 2.1 as our Secure Token Service. Users were able to access CRM without any issues, but our custom applications were unable to establish a connection with CRM via the SDK. The error message we were getting was The Authentication Endpoint Kerberos was not found on the configured Secure Token Service.

As part of our ongoing troubleshooting, we tried to use the Plugin Registration Tool to connect to an organisation in our CRM 2013 deployment. However, this was giving us an error stating that there are no organisations to connect to.

A Knowledge Base Article has been released by Microsoft which outlines the steps to fix this issue. This involves updating the MEX Endpoint by running the provided Powershell script. However, you may encounter the following error during the execution of the script.

Error: The Deployment Service cannot process the request because one or more validation checks failed.

VerifyConfigurationEntityNotAmbiquous raising error: This setting has multiple instances. The Id of the instance is required to set or get the ActiveMexEndPoint property.

Solution

On the SQL Server, connect to the MSCRM_CONFIG database and look for the dbo.FederationProvider system table. Next, run the built-in script to select the top 1000 rows.

clip_image001

You should see more than one entry in this table, as suggested by the error message above. You will need to update the ActiveMexEndpoint property for all entries to match the following URL:

https://sts.mydomain.com/adfs/services/trust/mex

Lastly, perform an iisreset on the CRM and ADFS servers and try running your custom application again. It will now connect to your CRM 2013 organisation without any issues!

CRM 2011 – Multiple Prompts for Credentials (401 Unauthorized)

A client recently encountered an issue with their UAT server, which prompted users for credentials three times before displaying an HTTP 401 (Unauthorized) error whenever they tried to login to CRM. Note that this only occurred when trying to access CRM by referencing the server name directly in the URL, for example http://myserver/crm. We found that a temporary workaround was to ask users to access CRM via the server IP address, in which access was granted upon the first attempt.

clip_image002

The actual cause of the error was due to the SPN (Service Principle Name) entries for the CRM application service account. The SPNs for the UAT server referenced the fully qualified domain name of that server. For example:

http/myserver.frostys.local FROSTYS\CRM2011.service

To fix the issue, simple remove the SPN which references the FQDN of the server and replace it with the following:

http/myserver FROSTYS\CRM2011.service

Please note that it may take up to 15mins to take affect but you should be able to login to CRM without the 401 unauthorized error.

Insufficient Privileges in CRM 2011

This error never fails to confuse those who are configuring security in CRM 2011, especially when you have only started defining your security matrix. Getting the base privileges right just so that users can simply login to CRM can be a time-consuming task and you will most likely get errors along the way. One of the most common errors you will encounter is the dreaded Insufficient Privileges message with no indication as to which privileges are actually missing!

clip_image001[4]

Thankfully with CRM 2011 on-premise, there is always the helpful Event Viewer. To find out which privileges are missing for the user and role in question, simply login to the CRM server and fire up the Event Viewer. Privilege related errors will show up as warnings and give you relevant information about what is wrong with your configuration. Here is an example of what the Event Log entry looks like.

Exception information: 
    Exception type: CrmException 
    Exception message: Principal user (Id=860c5b18-15b9-e211-8d4b-00155d04dc01, type=8) is missing prvReadWebResource privilege (Id=4156db68-93e2-4a83-8cbb-5bb344ebaf47)
   at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.XrmExecuteInternal()
   at Microsoft.Crm.Application.Platform.ServiceCommands.RetrieveMultipleCommand.Execute()
   at Microsoft.Crm.Application.Components.Handlers.WebResource.RetrieveWebResource(String webResourceName, String preview)
   at Microsoft.Crm.Application.Components.Handlers.WebResource.ProcessRequestInternal(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

We can see here that the user is missing the read privilege for the Web Resource component. I can now update check all Security Roles assigned to the user and include this missing privilege where necessary. Sometimes it takes multiple attempts to get rid of the error, so you need to be patient with this process.

One of the main privileges that is missed when defining security roles is the ability to read user settings (prvReadUserSettings). This is required when rendering views for example, as CRM needs to look into your personal options to figure out how many records per page you wish to see at a time.

I hope this post will help you when you start to map out your security matrix for Dynamics CRM 2011.

CRM 2011 – Customize Address Views?

I have recently been working with a customer who asked if it’s possible to create new views for the out-of-the-box Address entity in CRM 2011 Online. I thought I would try this in the Chrome browser only to see that the “view toolbar” was not available, so I was unable to create a new view or modify the default view for the entity.

image

The interesting thing about this problem is that if we look at the managed properties for the Address entity, it says that we can create new views.

image

So how do we create a new view for this entity? We can open up the All Customer Addresses view and use the Save As option.

image

I have customized the new view as shown on the screenshot below. After we save and publish, we should now see this view available on the Address entity.

image

image

You could also create a new Address view by adding a sub-grid to a form and then select the “New” option on the view selector.

Dynamics CRM HTML Web Resources in Visual Studio 2013

Microsoft has released some great new features with Visual Studio 2013 that is guaranteed to please Dynamics CRM developers. At Build 2013, Scott Hanselman and Mads Kristensen showcased some time-saving shortcuts that will surely help developers focus on their coding and get their jobs done faster. Please note that some of these features are made available through the Web Essentials 2013 extension, but may be released as part of the Visual Studio 2013 final product.

Special Characters

Web developers will know how difficult it is to add special characters to an HTML page. A popular character for web pages is the “copyright symbol”. Personally, I would insert the symbol into Microsoft Word document and then copy it back into the HTML editor. With Visual Studio 2013, you can simply hold down SHIFT + 7 (the ampersand key) and the HTML editor will display a drop-down-list of all special characters to insert into your document.

clip_image002

Smart Tags

Like the CSS editor, smart tags allow developers to simply hover over an HTML tag to quickly view or define the properties of the tag. For example, you can hover over the <img> tag and select Insert Height and Width Values. Visual Studio 2013 will find the image on disk and insert the correct height and width values into the <img> tag. Visual Studio 2013 also provides the ability for you to define your own smart tags.

clip_image004

clip_image006

Another useful feature is the ability to quickly write complex HTML structures with nested tags all in a single line. For example, if we want to define a section with a single div tag which contains an unordered list with four items, we can simply write the following code:

section>div>ul>li*4

After hitting TAB, the HTML editor will automatically write out and format the HTML code for you!

clip_image008

It is also very easy to generate lorem ipsum text by simply typing “lorem” and then hitting the tab key.

clip_image010

clip_image012

Voice Commands!

No I’m not kidding, Visual Studio 2013 includes voice commands to do things like launch the options window or format HTML documents. Stay tuned for a future post which will show a video demonstration.

Microsoft has invested a lot of time and effort into improving the web development experience in Visual Studio 2013. Like the enhancements made to the JavaScript and CSS editors, the changes made to the HTML editor are designed to eliminate the need to fiddle around with code so you can quickly produce rich web experiences with little hassle.

Dynamics CRM CSS Web Resources in Visual Studio 2013

Microsoft has released some great new features with Visual Studio 2013 that is guaranteed to please Dynamics CRM developers. At Build 2013, Scott Hanselman and Mads Kristensen showcased some time-saving shortcuts that will surely help developers focus on their coding and get their jobs done faster. Please note that some of these features are made available through the Web Essentials 2013 extension, but may be released as part of the Visual Studio 2013 final product.

The CSS editor in Visual Studio 2013 provides some useful tooltips when you hover over CSS code. For example, the screenshot below shows what happens when you hover over a snippet of code in your CSS library. The CSS editor displays a tooltip which indicates that the current piece of CSS is supported by all browsers.

clip_image001

Tooltips are also provided when hovering over image paths defined in tags such as background-image. The CSS editor displays the image in a tooltip from inside the CSS editor!

clip_image003

The enhancements made to the CSS editor will greatly benefit Dynamics CRM developers who are writing CSS for their HTML web resources. With the new cross-browser support in Dynamics CRM, developers can easily identify which snippets of CSS code are likely to break.

Dynamics CRM JavaScript Web Resources in Visual Studio 2013

Microsoft has released some great new features with Visual Studio 2013 that is guaranteed to please Dynamics CRM developers. At Build 2013, Scott Hanselman and Mads Kristensen showcased some time-saving shortcuts that will surely help developers focus on their coding and get their jobs done faster.

You might recall the new JavaScript editor that was shipped with Visual Studio 2012. Microsoft has taken it one step further with a new and improved JavaScript experience.

We’re all used to the drop-down-list in Visual Studio which allows us to jump to methods when writing code in native .NET languages. This is now available within the JavaScript editor to make it easier to work with large JavaScript files. Gone are the days of excessive scrolling!

clip_image002

clip_image004

The JavaScript editor now has support for constants. If you declare a constant variable and then try to assign it another value, the JavaScript editor will indicate that this is not allowed.

clip_image006

With Web Essentials 2013, developers can also keep their code tidy by adding regions into JavaScript files. Because Visual Studio 2013 is in a preview release, we may see this feature available once the full version comes out.

clip_image007

clip_image008

If you want to easily identify where a variable or function is being used, you can simply click on the name of a variable or function and the JavaScript editor will automatically highlight all references to that variable or function.

The additions to the JavaScript editor in Visual Studio 2013 will definitely make it faster and easier for Dynamics CRM developers to write client-side code for forms and ribbons.