Saturday, 28 September 2013

Installing CRM 2013

With the upcoming release of CRM 2013 and the current availability of the RC 1 build, thought I'd share the steps on how to get this installed.
Prerequisites
Windows 2008 Server x64 or Later
SQL Server 2008 x64 or Later


1. Launch the SetupServer.exe to start the install. Click Next

2. Here you can select the roles you want to install, for demonstration purposes I'm going to install all the roles on a single server. However it is strongly advised to separate roles across multiple computers to distribute processing load. Click Next

3. Select the "Create a new Deployment" option, then enter in the name of the SQL Server instance you want to use for this CRM 2013 deployment. Click Next

4. Select the OU you want to use for this CRM 2013 Deployment. Click Next

5. Specify the Service Accounts you want to use for each service listed. Click Next

6. Here you can decide if you want to install CRM to use the Default Website within IIS or create a new website with a specified port. Click Next

7. This is an optional step where you can specific the server name of the Email Router. If you plan to do this at a later stage, keep in mind that you will need to add the computer to the AD PrivUserGroup. Click Next

8. Enter in a unique name for the Database name, which will be used for the default CRM Organization name. Here you can also set the currency settings and SQL collation. Please note that the SQL collation cannot be changed later. Click Next

9. Enter in the URL to the SSRS report server. Click Next

10. Click Next

11. Select which option you want to use for Microsoft Updates and Click Next

12. The installer will perform the necessary system checks. You will notice a warning statement regarding Date encryption which is new to CRM 2013, this states: 


"Data encryption will be active after the install or upgrade. We strongly recommend that you copy the organization encryption key and store it in a safe place. For more information, see http://go.microsoft.com/fwlink/?LinkId=316366."

Click Next

13. Click Next

14. Confirm you are happy with all configuration settings and click Next

15. That's it, CRM 2013 is now installed successfully. Optionally you can install SSRS Reporting Extensions


Monday, 23 September 2013

CRM 2011 Installation Error - Setup failed to validate specified Reporting Services Report Server

When trying to install CRM 2011 in an environment where the SQL Server machine name has been changed, you may experience an error displayed below:
"Setup failed to validate specified Reporting Services Report Server"

You may have also experienced the issue The instance name must be the same as computer name

The  "Setup failed to validate specified Reporting Services Report Server" issue, is due to an incorrect server name being used by SSRS. 

1. To fix this, start the Reporting Server Configuration Manager and click on the Change Database option displayed below

2. Report Server Database Configuration Wizard

3. Click Next, you will see the server name being used

4. Correct the server name and use the Test Connection to confirm all is good

5. Select the Report Server Database

6. Click Next and wait for all tasks to complete

7. Click Finish and re-run the CRM Installer, now it should resolve the correct SSRS report server

Sunday, 22 September 2013

CRM 2011 Installation Error - The instance name must be the same as computer name

Recently when installing CRM 2011, I came across an error I haven't seen in sometime. 
The instance name must be the same as computer name.


The cause of this error, was due to the SQL Server Instance machine name being changed. More Importantly the server name change was done after the SQL server software had been installed.

Fortunately the steps to rectify this are pretty simple as follows:

1. Connect to the SQL Instance using Management Studio and identify the current name

2. Next we need to drop this server name as displayed

3. Now we need to add the correct server name

4. Finally Restart the SQL Service Services

That's it, now when you re-run the installer and perform the system checks, the error should not appear.


Wednesday, 11 September 2013

CRM 2011 - Add/Remove Team Members

Records within CRM 2011 can be owned by either a User or a Team. 
Using Teams within CRM 2011 are a great way of sharing records between users whom:
  • Are in different Business Units
  • Do not have the correct security role against their User record
  • Don't have ownership of the record(s) they want access too
However, the main benefit of Team ownership compared to User, is that ownership is shared by all members of the owning team, rather than a single user. Security Roles applied to that Team can elevate what a User can do when being a member.


An important part of maintaining this form of ownership, is to automate how members of a Team are added and removed, you may at times want to link certain UI actions to trigger these events. This can be done very easily from within a plugin as shown below:

  1. /* Add Users to Team */
  2. AddMembersTeamRequest addMembersTeamRequest = new AddMembersTeamRequest();
  3. addMembersTeamRequest.TeamId = Guid.Parse("831F6F02-6947-46BC-BDDF-6571075569A9");    //Team
  4. Guid[] arrMembers = new Guid[] {
  5.   new Guid("A4349C86-6475-43E6-BC1D-C3244115107C"),                                   //User 1
  6.   new Guid("8121CF3B-93B4-4907-9888-46FFAA11A169")                                    //User 2
  7. };
  8. addMembersTeamRequest.MemberIds = arrMembers;
  9. AddMembersTeamResponse addResponse = (AddMembersTeamResponse)ServiceProxy.Execute(addMembersTeamRequest);
  10.  
  11. /* Remove Users from Team */
  12. RemoveMembersTeamRequest removeMembersTeamRequest = new RemoveMembersTeamRequest();
  13. removeMembersTeamRequest.TeamId = Guid.Parse("831F6F02-6947-46BC-BDDF-6571075569A9"); //Team
  14. arrMembers = new Guid[] {
  15.   new Guid("A4349C86-6475-43E6-BC1D-C3244115107C"),                                   //User 1
  16.   new Guid("8121CF3B-93B4-4907-9888-46FFAA11A169")                                    //User 2
  17. };
  18. removeMembersTeamRequest.MemberIds = arrMembers;
  19. RemoveMembersTeamResponse removeResponse = (RemoveMembersTeamResponse)ServiceProxy.Execute(removeMembersTeamRequest);

Friday, 16 August 2013

CRM 2011 Connections - How to filter Connection Roles?

I’m not going to explain the uses of Connections within CRM 2011, I think we are all aware of their benefits by now.

This post is to share my opinion of the default behavior of the Connection entity form, whereby the "As this role" look up field displays all the Connection Roles defined, where in comparison I with many others believe it should by default filter to only those for the specific Entity.

Example Solution
You could potentially create some Views, but you could end up with quite a few, depending on the number of entities you are using Connections with.

In this case I prefer to use a Custom Lookup, the main benefits are that the user doesn't have to select the view, as these are defaulted to what we set them too and eliminates room for error.

For the purpose of this example, the following code filters the look up based on which Roles are applicable to the connecting from entity type.

  1. function filterConnectionRoles() {
  2.   try {
  3.     // Identify Connecting From Entity
  4.     var connectfromEntity = Xrm.Page.getAttribute("record1id").getValue()[0].typename;
  5.  
  6.     // Construct oData query to retrieve list of associated Connection Roles
  7.     var oDataEndpoint = Xrm.Page.context.getServerUrl() + "/XRMServices/2011/OrganizationData.svc";
  8.     var oDataQuery = oDataEndpoint + "/ConnectionRoleObjectTypeCodeSet?$filter=AssociatedObjectTypeCode eq '"
  9.         + connectfromEntity + "'&select=ConnectionRoleId";
  10.  
  11.     // Execute oData Query
  12.     $.ajax({
  13.       type: "GET",
  14.       contentType: "application/json; charset=utf-8",
  15.       datatype: "json",
  16.       url: oDataQuery,
  17.       beforeSend: function (XMLHttpRequest) {
  18.         XMLHttpRequest.setRequestHeader("Accept", "application/json");
  19.       },
  20.       success: function (data, textStatus, XmlHttpRequest) {
  21.         if (data != null) {
  22.  
  23.           // Build the condition values
  24.           var conditionValues = "";
  25.           for (var i = 0; i < data.d.results.length; i++) {
  26.             conditionValues += "<value>" + data.d.results[i].ConnectionRoleId.Id + "</value>";
  27.           }
  28.  
  29.           if (conditionValues.length > 0) {
  30.             // Construct Fetch Query
  31.             var viewId = "{E3319041-5017-4353-A578-AEC2CCF28DA8}";
  32.             var viewDisplayName = "Connection Roles";
  33.             var fetch = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" +
  34.                             "<entity name='connectionrole'>" +
  35.                                 "<attribute name='name' />" +
  36.                                 "<attribute name='connectionroleid' />" +
  37.                                 "<order attribute='name' descending='false' />" +
  38.                                 "<filter type='and'>" +
  39.                                     "<condition attribute='connectionroleid' operator='in' >" +
  40.                                     conditionValues +
  41.                                     "</condition>" +
  42.                                 "</filter>" +
  43.                             "</entity>" +
  44.                         "</fetch>";
  45.  
  46.             // Construct Grid Layout
  47.             var grid = "<grid name='resultset' object='3231' jump='name' select='1' icon='1' preview='1'>" +
  48.                 " <row name='result' id='connectionroleid'>" +
  49.                     " <cell name='name' width='200' />" +
  50.                 " </row>" +
  51.             "</grid>";
  52.  
  53.             // Add Custom Lookup View
  54.             $("#record2roleid").attr("disableViewPicker", "0");
  55.             Xrm.Page.getControl("record2roleid").addCustomView(viewId, "connectionrole", viewDisplayName, fetch, grid, true);
  56.             $("#record2roleid").attr("disableViewPicker", "1");
  57.           }
  58.         }
  59.       },
  60.       error: function (XmlHttpRequest, textStatus, errorThrown) {
  61.         alert('oData Error: ' + oDataQuery);
  62.       }
  63.     });
  64.   }
  65.   catch (ex) {
  66.     alert(ex);
  67.   }
  68. }

Thursday, 15 August 2013

How to Open a new Form & Set Field Values?

Here's a short post demonstrating how you can use JScript to open a new CRM form window, and set the field values in CRM 2011.

There are two methods to achieve this. Both involve using JavaScript, however selecting the best approach depends on what you want to do with the window once opened?

Method A - Xrm.Utility.openEntityForm 
This uses the Xrm utility helper object provided as part of the CRM platform. Under the hood, it is using the same call as method 2 to launch the new window. But the benefits are that it eliminates the need of creating and encoding the URL to the entity type you want to open.

Disadvantages are that you get no handle to the newly opened window.

Method B - window.open 
This is the standard JavaScript method of launching a new window. All you old school developers should be familiar with this one :) 
The disadvantage with this approach is that you have to construct the correct URL in order to launch the correct CRM Form. 

The benefit with this method is that you can obtain a handle to the new window and perform the actions you JavaScript junkies are accustomed too.

Example Solutions
The following are examples of both methods using the Contact entity for demonstration purposes:


  1. function openNewForm_MethodA()
  2. {
  3.     var params = {};
  4.     
  5.     //Set Parent Customer Lookup Field
  6.     params["parentcustomerid"] = "EA27A654-79EA-400B-9DE6-84C8E11394B4";
  7.     params["parentcustomeridname"] = "My Account Name";
  8.     params["parentcustomeridtype"] = "account";
  9.     
  10.     //Set Standard Text Fields
  11.     params["firstname"] = "John";
  12.     params["lastname"] = "Smith";
  13.     params["mobilephone"] = "1234567890";
  14.     params["emailaddress1"] = "mail@domain.com";
  15.         
  16.     //Open new Window/CRM Form
  17.     Xrm.Utility.openEntityForm("contact", null, params);
  18. }
  19.  
  20. function openNewForm_MethodB()
  21. {
  22.     //Set Parent Customer Lookup Field
  23.     var extraqs = "parentcustomerid={EA27A654-79EA-400B-9DE6-84C8E11394B4}";
  24.     extraqs += "&parentcustomeridname=My Account Name";
  25.     extraqs += "&parentcustomeridtype=account";
  26.     
  27.     //Set Standard Text Fields
  28.     extraqs += "&firstname=John";
  29.     extraqs += "&lastname=Smith";
  30.     extraqs += "&mobilephone=1234567890";
  31.     extraqs += "&emailaddress1=mail@domain.com";
  32.  
  33.     //Set Features & Open new Window/CRM Form
  34.     var features = "location=no,menubar=no,status=no,toolbar=no";
  35.     var newWindow = window.open("/main.aspx?etn=contact&pagetype=entityrecord&extraqs=" +
  36.     encodeURIComponent(extraqs), "_blank", features, false);
  37.     
  38.     //Optionally - you can interact with the Window e.g. Resize it etc...
  39.     newWindow.resizeTo(528, 500);
  40. }

Saturday, 3 August 2013

CRM 2011 - PluginType' entity doesn't contain attribute with Name = 'customworkflowactivityinfo'.

Thought I'd share a quick post, regarding an error you may get when trying to import a solution into a CRM 2011 organization.

PluginType' entity doesn't contain attribute with Name = 'customworkflowactivityinfo'.

The issue is caused by a version difference between the source and destination CRM servers. 

Solution

1. Check that the destination CRM server has the same or greater Update Rollup installed. If not then update the destination server. Update 10 or greater is required if you had imported this organization from a CRM 4.0 system.
2. Using Deployment Manager verify that the Organization you are attempting to import the solutions into has the correct version, if not then use the Update process.
This should resolve the issue.

Action Microsoft.Crm.Setup.Common.Analyzer +CollectAction failed. Fatal error during installation

When installing the Srs Data Connection (Microsoft Dynamics CRM Reporting Extensions), you may have experienced the following error: ...