CRM Blog

July 2008 - Posts

Problems Running CRM 4.0 Reports Post-Installation or Upgrade, Even after installing Microsoft CRM Data Connector
by Shelley Lane 07.16.08

Comments    No Comments

When installing CRM 4.0 (or upgrading from 3.0) in an environment where SQL Server, SQL Reporting Services and CRM will all be on separate physical machines, you must use the Microsoft CRM Data Connector to bypass authentication issues. Once you’ve done this, your servers will all be able to communicate without issue and your reports will work swimmingly!

 

Well, almost. Recently, I encountered two separate instances (a new install and an upgrade, both using the Data Connector) where we had run all of the installs without any problems, but attempts at running any reports lead to the dreaded "Page Cannot Be Displayed" error.

 

In one case, the event log on the SQL Reporting Services server had several security audit failures. In there other case, there were no errors to be seen. However, both situations were the result of our Report Manager not being properly configured.

Follow these steps to verify that yours is configured correctly and, hopefully, save yourself some time.

  1. Open up Report Manager (http://SRSServer/Reports)
  2. Click on OrgName_MSCRM
  3. On the right-hand side, on the toolbar, click Show Details
  4. Click on the 4.0 folder
  5.  Then locate and click on MSCRM_DataSource
  6.  Verify that Connection Type is set to "Microsoft CRM Data Extension" and Connect using: is set to "Credentials supplied by the user running the report"
  7. Click Apply

 

Filed under:
Creating a 1:N Relationship with Parental Behavior causes "No Attribute" Error
by Zahara Hirani 07.16.08

Comments    1 Comment(s)

If you have tried creating a “1:N” relationship between a system entity and custom entity with the "Type of Behavior" property set to “Parental”, you most probably have also gotten an error when you try to save the system entity after updating its parent.

Let’s consider a Contact entity and a custom entity called Specialization. The relationship between Contact and Specialization is a “1:N” relationship with the "Type of Behavior" property set to “Parental”. Contact being a system entity already has a “1:N” relationship with the "Type of Behavior" property set to “Parental” with the Account entity.

So when you try to update the Contact's Parent Customer attribute and save, you are re-parenting the Contact. Since you have a relationship with "Type of behavior" set to “Parental” between the Contact and Specialization, CRM tries to re-parent the Specialization record with the updated Account object which it doesn't find. Hence the "no attribute" error.

To fix the issue, change the relationship between the Contact and the Specialization to “Configurable Cascading” and set the Re-Parent property to "Cascade None"; Save and Publish and your all set.

Now if you try to re-parent the Contact, CRM won’t try to re-parent the specialization record since the Re-Parent property is set to "Cascade None".

Filed under:
CRM Custom RSS Feed in less than 30 minutes
by Mitchell Kett 07.11.08

Comments    1 Comment(s)

One of the best ways to improve a client's business is to keep users better informed and up-to-date on the information provided by CRM.  A workflow could be created (and maintained) to send out an email to the appropriate parties when a specific event happens (create, update, delete of an entity), but what if we could go one step further and provide the same up-to-date information without emails (and maintaining who gets what) or without the need for a user to look in CRM?  What about using an RSS feed?

 

Thanks to a very useful tutorial provided by Jeff at uberasp.net, creating an RSS feed for CRM can be done in a matter of minutes.  For a very quick crash course in XML and the syntax for RSS, see  http://www.w3schools.com/rss/rss_syntax.asp .

 

Say I'd like to create an RSS Feed for a specific entity in CRM.  Whenever a new record is created for this entity, I want to see it in my RSS Feed.  For this example, I created a custom entity in CRM called "new_rssfeed".  The only attribute I added to new_rssfeed was an ntext field called "new_description" which will contain text describing the new record.  After publishing my new entity type, I opened up Visual Studio 2005 and started a new ASP.Net Web Site.  I renamed the Default.aspx file generated by VS to "RSS_Feed.aspx" and changed the code to the following:

 

//RSS_Feed.aspx

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="RSS_Feed.aspx.cs" Inherits="_Default" EnableViewState="false" %>

<%@ OutputCache Duration="300" VaryByParam="none" %>

 

Yup, that is all you should see in your .aspx file.  No need for any html tags or DOCTYPE declarations.  What will happen is that when a user navigates to the RSS_Feed.aspx file, the Page_Load event will generate a stream of XML code which the web browser will interpret as an RSS feed.  So there is no need for any HTML.

 

Within the code-behind file, RSS_Feed.aspx.cs, I added the following code to generate the XML for the feed within the Page_Load event.  You can use this code as a template for your own feed.

 

//RSS_Feed.aspx.cs

protected void Page_Load(object sender, EventArgs e)

    {

Response.Clear();

Response.ContentType = "text/xml";

XmlTextWriter objX = new XmlTextWriter(Response.OutputStream, Encoding.UTF8);

objX.WriteStartDocument();

objX.WriteStartElement("rss");

objX.WriteAttributeString("version","2.0");

objX.WriteStartElement("channel");

objX.WriteElementString("title", "Practice CRM RSS Feed");

objX.WriteElementString("link","http://localhost:5555/RSS/RSS_Feed.aspx");

objX.WriteElementString("description","Live, up-to-date information coming from CRM!");

objX.WriteElementString("copyright","(c) 2008. All rights reserved.");

objX.WriteElementString("ttl","5");

SqlConnection objConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["crmConnectionString"].ToString());

objConnection.Open();

string sql = "SELECT TOP 10 new_name, new_description, new_rssfeedid, createdon FROM new_rssfeed ORDER BY createdon DESC";

SqlCommand objCommand = new SqlCommand(sql, objConnection);

SqlDataReader objReader = objCommand.ExecuteReader();

while (objReader.Read())

{

objX.WriteStartElement("item");

objX.WriteElementString("title",objReader.GetString(0));

objX.WriteElementString("description",objReader.GetString(1));

objX.WriteElementString("link", "http://localhost:5555/MicrosoftCRM/userdefined/edit.aspx?id=" + objReader["new_rssfeedid"].ToString() + "&etc=10008");

objX.WriteElementString("pubDate", objReader.GetDateTime(3).ToString("R"));

objX.WriteEndElement();

}

objReader.Close();

objConnection.Close();

 

objX.WriteEndElement();

objX.WriteEndElement();

objX.WriteEndDocument();

objX.Flush();

objX.Close();

Response.End();

    }

 

Notice the bolded text within the code.  These are snippets that will differ in your code.  For my RSS feed, I gave it the title of "Practice CRM RSS Feed".  The link element is for the URL used to get to the aspx file.  For my connection to CRM, I simply created a web.config file with a connection string to my CRM DB.  Throw in your own custom SQL Query to grab the necessary info to populate the "title", "description", "link", and "pubDate" for the feed <item> element.  The above code, in a nut shell, will grab the 10 most recently added New_rssfeed elements and format them for the feed.  I built and published the web site project and the last thing to do was configure IIS to make the feed accessible.

 

In IIS, all that I needed to do was create a new virtual directory with the alias "RSS" under the Microsoft CRM web site and point it to the folder with the compiled web code.  It automatically saw the web.config file, so no other adjustments had to be made.  Do an IIS reset and navigate to the aspx page.   You should see a basic page with the feed title and a description of how to subscribe to the feed.  You will also see the feed articles listed below and search options to the right (I used IE7 -- other browsers may render differently or re-direct to an RSS Reader like Google Reader).

 

Example of RSS Feed rendering in IE7 (click to view larger image)

 

Just think of what you could use this for!  You could integrate workflows and plugins with an RSS feed in order to provide up-to-date info on what's happening in CRM to other users (or anyone within the local network).  Inform sales people of new opportunities and leads, give executives updates by the minute as opportunities close and new ones come in.  Create one generic feed and register a plugin for multiple actions which could generate a variety of updates to the feed.  You could even create multiple feeds/aspx files and give users the option of how much/ little they'd like to get updated on.  We could even throw in a couple parameters  like entity type and GUID and we've got an RSS feed for one specific record in CRM. 

 

I merely scratched the surface of RSS (you can add images and other content as well), so be creative and think of how you might be able to use this to keep users (and developers) better informed of what's going on in CRM.

Adding An I_Frame For An N:N Relationship
by Danny Varghese 07.10.08

Comments    No Comments

I've mentioned in a previous post how to add an I_Frame to a related entity: http://crowechizek.com/cs/blogs/crm/archive/2008/03/18/adding-an-i-frame-that-contains-a-view-of-related-entity.aspx.  The steps mentioned work for any entity that has a 1:N or N:1 relationship in both CRM 3.0 and now the new CRM 4.0 (Titan).  As you all know, Titan now has the ability to create N:N relationships!  With any new feature comes some new challenges, but not to worry, you can add an I_Frame for N:N related entities.  Thanks to a user who posted a comment on my blog article, I did a little digging and found that an additional parameter is needed in the url.

The additional parameter is shown in red and has been added to the original code from my other post:

 var urlAct = ""; urlAct =  "areas.aspx?oId=" + crmFormSubmit.crmFormSubmitId.value + "&oType=" + crmFormSubmit.crmFormSubmitObjectType.value + "&security=" + crmFormSubmit.crmFormSubmitSecurity.value +"&tabSet=areaActivityHistory" + "&roleOrd=2";document.getElementById('IFRAME_History').src = urlAct;

Although I don’t have confirmation of what this parameter is, I believe it may stand for "Role Ordinal."  If you look at the definition of the word "ordinal," it means to define the order or succession of something.  This parameter appears to define which side/order of the N:N relationship to display.  In the example above, the value is "2," which represents which side of the relationship you want to view.  So if you create an N:N relationship say from the Account entity, and you're asked to fill in the "Other Entity" section, that would represent the variable "2."  Another way to look at it is, if you're on the Account form, and you want to create an I_Frame pointing to the related entity of the N:N relationship, then the "roleOrd" is 2.  The best way to find the value of this parameter is if you view the source of the page you're on, do a find for "roleOrd," and see what the value is for the related entity.

Either way, I've seen this example work.  If anyone has any comments on this parameter, please do comment.  Thank you!

Filed under:
CRM 3.0 Callouts not working after 4.0 Upgrade
by Luke Simpson 07.09.08

Comments    2 Comment(s)

If you have just completed an upgrade of your CRM system from 3.0 to 4.0, you might have discovered that your 3.0 Callouts are no longer working properly.  This can be a very annoying problem, as most organizations do not want to upgrade all of there server side code right away, and need it to work immediately as promised.  One of the simplest ways to debug this issue is to make sure that the Microsoft.Crm.Platform.Callout.Base.dll has been registered in the GAC during the upgrade process.  If this wasn't successful, all of your 3.0 callouts will fail.  Often with cryptic and unexplainable error messages.  If you see that this dll is not registered in the GAC, simply register it and run an IISReset.  Then retest your code.  I would be willing to bet that this solves your problem.

 The assumption to all this, of course, is that the callouts were working properly before the upgrade!

Filed under: