Wednesday, September 14, 2011

Accessing Silverlight from JavaScript

Hey everyone!
Today's post deals with accessing a silverlight web resource from javascript.
An example of when this is needed is if you want ineraction between a ribbon button and an embedded silverlight control.

First things first this post assumes you have already added the button to the ribbon, added the js file to the web reources and have wired up the sitemap to hit the approriate function.

So at this point you're in your JavaScript function and you want to see a web resource object on the form. First, you have tro find the name of the resource (customize the form). Once you have it you need to reference in it your js code.

Oh yeah that reminds me, you need to add [ScriptableType] to your code behind class and [ScriptableMember] to your member. Once you do that, you're silverlight web resource is good to go.

Ok so now we have a silverlight web resource control on the form and you want to find the member.
JavaScript code:

var resource = Xrm.Page.ui.controls.get("WebResource_sample");
var obj = resource.getObject();

TBD!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Monday, June 6, 2011

PreFiltering CRM 2011 Reports

Report prefiltering in CRM 2011 narrows the scope of a report, return faster results and can lead to more revelant data.  Instead of just creating a report parameter, report prefiltering uses the Advanced Find fetch queries.  This allows the creation of end user defined queries while still in CRM.

A sample query:
SELECT name, accountnumber
FROM FilteredAccount as CRMAF_Account


For more information click the link below!

Happy Coding!

Dynamics Blog Link:
http://blogs.msdn.com/b/crm/archive/2009/03/06/microsoft-dynamics-crm-pre-filtering-tips.aspx

Tuesday, April 26, 2011

Importing Solution to Another Organization Changes ObjectTypeCode

An issue came up yesterday regarding importing one organization's customizations (sitemap, isv.config, custom entities, etc.) into another. While the files imported successfully and everything appeared correct we quickly realized one crucial error we had assumed...

When importing a solution to another organization changes the ObjectTypeCode of every custom entity!

The ObjectTypeCode is the database equivalent of the ETC query string parameter. In simpler terms, any reference to the etc code in the URL of any custom entity will be in correct.
The issue it seems is that when importing, CRM ignores the ObjectTypeCode node in the customizations.xml and instead inserts them alphabetically instead.

So if you had an entity named new_account and it had an etc of say 10100 which typically means its the one hundredth custom entity created, it will now be 10000 since it is the first alphabetically.

So what's the solution?

Some workarounds mentioned around the web and in the msdn forums is to use the ObjectTypeName, abbreviated OTN. If you notice when crm generates the url for a custom entity it adds this as a query string parameter labeled objecttypename=new_account.

So by using this method you avoid using the etc and refer to the string equivalent. I have always assumed this etc number to carry over since its in the xml but its not.


Happy Coding!

Tuesday, April 5, 2011

TechNet Online Documentation for MSCRM 2011

Link:
http://technet.microsoft.com/en-us/library/bb496811.aspx

The link above gives you access to the technet documentation.
The navigation to the left will allow to choose from the following:

  • Installation
  • SDK
  • White Papers
The Installation section includes the following:
  • Introduction
  • Planning Guide
  • Installing Guide
  • Operating and Maintaining Guide
The SDK section links to this page which will give developers sample code and quickstart solutions. The Link: http://technet.microsoft.com/en-us/library/gg309408.aspx

The White Papers section currently only houses the Claims Based Authentication but will be expanded soon.

This is a valuable go to resource for any CRM developer!

Happy Coding!