Thursday, December 1, 2011

CRM 2011 - Retrieving Organization Information

There are many ways to retrieving Organization-Information in code. Some of them are explained in this post.
  • Javascript
  • Organization-Webservice
  • Discovery-Webservice 
  • ...
1.) Javascript (Only Unique-Name)
The XRM-Context offers the a function for retrieving the org unique name.
Xrm.Page.context.getOrgUniqueName()

 This function can be used in Javascript/HTML- and Silverlight-Webresources.

2.) Organization-Webservice (Only Display-Name)
The SOAP-Endpoint of the CRM-System (http://crm:5555/XRMServices/2011/Discovery.svc) offers the default request-functionality for the "organization" entity. The record contains the field "name" which holds the display-name.

Important: If the system is created with import organization and the display-name has been changed in this process, the name in the organization-table of the _MSCRM Database is NOT changed. It still contains the name, selected generating the organization the first time.


3.) Discovery-Webservice (Display & Unique)

The discovery-endpoint also contains a functionality to retrieve organization data. This can be achieved by using the RetrieveOrganizationRequest.

Two remarks if you are using this approach:
  • There is no documentation available, how you can use discovery-endpoint in Silverlight-Webresources
  • The code will not run in offline-mode (SDK: This message works only when connected to the server.)
Update November 2012: The RetrieveOrganizationRequest is not working correctly in online systems for this purposes. Thanks to Mitch Milam.

Cheers,
Markus

Wednesday, November 30, 2011

CRM 2011 - "HTTP 500 - Internal Server Error" using SOAP Endpoint in Silverlight Webresources

Requesting data over organization endpoint results in the following error.
HTTP 500 - Internal Server Error

The problem may be a missing provider-setting in the IIS configuration.


Solution:
  • Open IIS Manager
  • Select "Microsoft Dynamics CRM" Site
  • Doubleclick "Authentication"
  • Right click "Windows Authentication"
  • Select "Providers"
  • Add "Negotiate"
  • IIS-Reset


 There should be two "Provider" entries.
  • Negotiate
  • NTLM
Cheers,
Markus

Tuesday, November 29, 2011

CRM 2011 - Import Organization - Errorcode: 0x80131904 The login already has an account under a different user name

Using Import Organization on a CRM 4 Database results in
Errorcode: 0x80131904 The login already has an account under a different user name

The problem are different users and schemas in the sql-database of the installed system (CRM2011) and the source system (CRM4). The system language of the CRM 2011 database is another language than the CRM 4 database has been.


Example (de/en):

CRM 4 based on Windows Server 2003 / SQL 2005 GERMAN
CRM 2011 based Windows Server 2008 R2 / SQL 2008 ENGLISH

The german systems contains the user and schema 'NT-AUTORIT√ĄT\NETZWERKDIENST'.
CRM 2011 database contains an user and a schema 'NT AUTHORITY\NETWORK SERVICE'. This is what the CRM 2011 system is expecting in the import org database.

Solution:

  • Create Database with name of CRM 4 source (_MSCRM) in SQL-Server of CRM 2011
  • Restore from backup of CRM 4
  • Delete the user and schema 'NT-AUTORIT√ĄT\NETZWERKDIENST' from restored database
  • Use Deploymentmanager and import the organization
Cheers,
Markus

Wednesday, May 18, 2011

Why using Internet Facing Deployment

There are so many articles explaining how to configure an Internet Facing Deployment (IFD) for Microsoft CRM. But why should you do this?

Two (main) points you should know about.

1. Microsoft Support

It IS possible to publish the CRM Website for external access without using an IFD. Therefore you have only to route the site through your firewall. BUT this is no Microsoft supported scenario.

2. Outlook Client external access

If you are using the Microsoft Dynamics Outlook Client for CRM and you would like to use it from outside the corporate network, you have to configure the IFD.

Summary:
If you would like to use Microsoft CRM from outside your Intranet/VPN, you have to configure Form Based Authentication (CRM 4) or Claims Based Authentication (CRM 2011).


This is the statement from a Microsoft Engineer:


"Publishing the website to the internet and not using Claims/IFD is not supported. Even though the web client may still work it wasn't tested or designed to be run that way. We don't document all the things we don't support but rather the things we do like IFD/Claims authentication.



The outlook client will not work in this scenario.”



Cheers

Friday, February 18, 2011

CRM 2011 - Debugging Silverlight Webresources without deploying

It finaly works!

Good week for CRM2011 developers!

1. Release of new SDK


2. New informations about WCF-Soap Endpoint

3. Finding a solution for debugging silverlight webresources without deploying the webresources (My personal breakthrough! :))


Ok, first of all i would like to thank "erik-lp" from the MSDN forum for his tipps.

Following things are required for debugging your silverlight webresource.
  • Developing Machine (Same or other domain doesn't mater)
  • CRM-Server (I have tested with RC)
  • clientaccesspolicy.xml
The clientaccesspolicy.xml
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
  1. Navigate to the Web-Folder of your CRM-System. (\..\Microsoft Dynamics CRM\CRMWeb\)
  2. Copy the created clientaccesspolicy.xml into this folder
  3. Open your silverlight project in Visual Studio (For this example, we assume you are using the SOAP example from SDK version 5.0.1)
  4. Navigate to the SilverlightUtility.cs class
  5. Replace following code in the GetSoapService() Method
Before:


Uri serviceUrl = CombineUrl(GetServerBaseUrl(), "/XRMServices/2011/Organization.svc/web");
After:
Uri serviceUrl = new Uri("http:///<ORGNAME>/XRMServices/2011/Organization.svc/web");

Now you can push F5 and start debuging.

This solutions only works in OnPremise Systems. You can not deploy clientaccesspolicy.xml in online systems.
Eric also talks about a ClientGlobalContext.aspx.js file. This is not required, if you replace the code in the SilverlightUtil.cs.

Happy coding!

cheers!

Thursday, February 17, 2011

CRM 2011 - Accelerate Silverlight Webresource Development

Yes, it is hard to develop "big" Silverlight applications against the new Organization Service. One of the biggest problems, is the time consuming deployment of the xap/html files as webresources.

Microsoft delivers a nice tool for accelerating this task a little bit. It is called "webresourceutility" and you can find it in the SDK. But only the sources are available. So you have to open it in Visual Studio 2010 and rebuild it.

If you would like to extract it from the SDK-Folder (Maybe for versioning), additional folders are required because references exists in the Visual Studio Project.

Required:
  • sdk\tools --> Contains the tool
  • sdk\bin --> Contains the Microsoft XRM/SDK assemblies
  • sdk\samplecode --> References to DeviceIdManager.cs, MyOrganizationCrmSdkTypes.cs and CrmServiceHelpers.cs
If you have opened the solution, you can see the WPF Application (implemented with MVVM-Pattern). Pressing F5 should already start the application but you will run into an exception concerning missing Identity Model. You have to install Windows Identity Framework

WIF Download
I am using the Version 6.1 and it works fine, but i don`t know the difference between 6.0 and 6.1.

If you are using Windows XP, look here.

Now the tool should work.



The first step ist NOT to enter some information. Please click "NEW" before! ;)

Now enter all the stuff:
  • Name: Describes the Name of your connection. Maybe you have DEV, QS, LIVE or stuff like this.
  • Server: IP or Servername with the port if it is used
  • Organization: CRM Organization-Name
  • Username: CRM-Username
  • Domain: Domain of CRM Server
All this information will be stored in "configurations.xml".

Clicking "Connect!" will open a prompt for the password. Enter the user password and click submit.

The application switches automatically to the "Solutions" tab. Here you can select one of the solutions, currently deployed to the CRM Server. If there is no solution available, you have to create a new one. Infos about creating solutions you can find in the actual SDK.

Select your solution and click "Choose".

The application will change to the "Web Resource Packages" Tab with a empty List. Clicking "New Package" will open a new area.

Here you can enter the content of your package.

  • Package Name: A Package is the summary of webresources you would like to deploy in this step. For example if you are deploying a Silverlight application you can deploy the .HTML and the .XAP.
  • Root Path: The place where all of your webresources are stored on your local disc.
  • File Search: All files which are available in the selected root path are displayed. You can filter them, select the required and then push the "Add Files to Web Resources" button.
  • Web Resources: Here you can see the added files. Another importand part is the "Use Package Name as Web Resource namespace". If you select this, the namespace/folder will be extended with the name of the package. This can be tricky in HTML-Pages which hosts Silverlight Apps)
  • Publish all customizations after uploading web resources: The resources will always be uploaded AND deployed.
  • Save Package: Save your configuration to the "packages.xml"-File
  • Upload All: Uploads all Webresources in the "Web Resources" Area
  • Upload Selected: Uploads the selected Webresources in the "Web Resources" Area
  • Show Output: Shows the log which was created in further import processes.
Thats it. Now you can Write Code --> Build --> Click Upload --> Test. You can also use the existing code in the tool to create your own console application which is triggered in the post build event of the crm. The concept of the XML-Files is perfect for this approach.

Another Tip:
Yes security is important, but in the DEV-Team the password to the User of a DEV-Server is not that big secret. So you can remove the password promt.

  • Open the webresourceutility Solution in Visual studio
  • Navigate to ..ViewModels\MainWindowViewModel.cs
  • Jump to "InstantiateService()" Method (should be line 694)
  • Change code:

Before:


//Get the Password
string password = String.Empty;
PasswordWindow pw = new PasswordWindow();
pw.Owner = Application.Current.MainWindow;
bool? submitted = pw.ShowDialog();
if (submitted.Value) {
password = pw.GetPassword();
} else {
ErrorWindow needPassword = new ErrorWindow("You need to supply a Password and Submit. Try again.");
needPassword.Owner = Application.Current.MainWindow;
needPassword.ShowDialog();
return;
}


After:

//Get the Password

string password = "YourPassword";



cheers

Wednesday, February 16, 2011

CRM 2011 - SDK Update available (Soap from Silverlight)

The SDK Update contains the missing documentation for using WCF-Soap endpoint from Silverlight webresources. This will solve the problems, described in my previous posts "Limitations oData Endpoint CRM 2011" and "CRM 2011 - Webresources and SOAP Endpoint".

Download
Online Version
Soap From Silverlight – Direct Link

Greetz,
MK