CRM 4 – Can’t assign FilterExpresion it’s read only!

I am up to my eyes in workflows today and I was trying to do a query to retrieve some items, so I had to refresh myself how to do it in CRM 4.  I thought I would try the sample code and when I pasted it a bit in, I got this error

Error:

Property or indexer ‘Microsoft.Crm.Sdk.Query.FilterExpresssion.Conditions’ cannot be assigned to — it is read only

The problem line of code was this one

filterPrincipal.Conditions = new ConditionExpression[] {conditionPrincipal};

There is nothing more frustrating when the sample code doesn’t work or compile.  The answer was oddly simple and I assume they must have changed how it worked sometime after CRM 4 was released and maybe I haven’t updated my sample code.

Anyway as the message said read only I used a bit of of intellisense to see what I could do with the condition and found there was an add.

So instead of assigning the Condition you have to add it like this.

filterPrincipal.Conditions.Add(conditionPrincipal);


Advertisements

one day left of free Sharepoint 2010 training

There is one day left of the free Sharepoint training

All you have to do is register and the training is free

http://blogs.msdn.com/b/ukisvdev/archive/2011/02/10/free-three-days-of-online-sharepoint-2010-developer-training-march-14th-to-16th.aspx

it looks to have some interesting topics, day 3 has some information about web services and workflows

Day 3 (Live Meeting 3 hours) 1:30 – 4:30
•         Client Object Model: The Client OM can be accessed via web services, via a client (JavaScript) API, and via REST
•         Accessing External Data: Business Connectivity Services (BCS) enables integration with back end systems
•         Workflow: A powerful mechanism to create functionality using Windows Workflow Foundation

CRM 2011 Tool – Jscript Soap Request Formatter

This blog seems to be the head of the Jamie Miley appreciation club this week and marvelous Miley has done it again today by releasing the CRM 2011 Jscript Soap Request Formatter.

Firstly you can read about it on his blog from his latest blog post here.  You can also download the tool at codeplex here.  I have to say I am always very grateful when someone from the CRM community creates a project on codeplex, these kind souls have saved me, hours/days with their excellent tools.

The reason the marvelous Miley has featured on my blog so much this week is because he has been devoting his time to Javascript, which is one of those areas I am yet to master, so all help is welcomed.

The blog entry features a link to a great article from the updated SDK CRM 2011 – Walkthrough: use the SOAP endpoint with Javascript.  This is a very useful article because it shows you how to capture the soap messages from calls to the iOrganizationservice by creating a soap logger.

The CRM 2011 Jscript Soap Request Formatter basically takes the soap message logged out and then creates some Javascript for you.  Nice, this could save you a lot of time creating the  javascript manually, especially with the += when creating a string which contains a soap message.

I was also interested to see an example of doing a soap call.

firstly calling the XRMservice

 var OrgServicePath = "/XRMServices/2011/Organization.svc/web";
and then the full call using the execute method of the CRM web service.

req.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute");

 

Good work the Marvelous Miley

VOTE NOW – 2011 TOP 100 MOST INFLUENTIAL MICROSOFT DYNAMICS PEOPLE

I subscribe to the RSS feed of Lion Tribes blog and today I thought it was quite amusing that he was urging people to vote for him in Dynamics world most influential Microsoft Dynamics person 2011.  Then again there isn’t anything wrong with a bit of self publicity and he does have a pretty good blog.

if you want to cast your vote, get over here and cast your vote, they have narrowed it down to 260.

http://www.dynamicsworld.co.uk/2011Voting.php

You have to say with CRM 2011 being released recently then you would probably say Kirill Tatarinov will probably come out on top.

CRM 4 – Debugging Javascript

I was trying to debug some javascript today in CRM 4.  I initially tried to use the brilliant F12 internet explorer (8 plus) web development tool.

A wierd thing happens in CRM 4 compared to CRM 2011.  In CRM 2011 because it is a web resource, it’s that file which is loaded.  This makes it easy to look at the list of scripts and then pick the one you want to debug.

but with CRM 4 it is different because it is a file called FormScript.js with lots of variables after it’s name.  The other frustrating thing is it doesn’t have your onLoad script in it straight away, it adds it later on.  This means you can’t put breakpoints on your code because it isn’t loaded yet.

The thing that really annoyed me was it kept creating a new Javascript file everytime I ran it.  Then once it was loaded and you put a breakpoint in the js file it created a new one.

In the end I did manage to put a breakpoint on the original FormScript.js and then one hit the breakpoint it had loaded my script and I could place some breakpoints in my code.  The only problem is I’m not totally sure I could do it again.

I also tried the debugger method.  This is basically adding the word debugger to your javascript code and then when it hits this, it asks you where you want to debug the code.  You can then choose Visual Studio and step through your code.

The only problem I had with this method is I couldn’t add breakpoints and the javascript I was trying to debug was creating functions and callbacks.  This is why it’s good to do it Internet explorer debugger because you can put breakpoints anywhere.

You should check out this blog post – Tips for productive Javascript in CRM dynamics 4.  It has a few good tips, the tip below shows you the settings you need to debug the javascript in visual studio, there is an internet explorer setting you need to adjust

 

Use the debugger statement in your code if you want to walk through code.  You are able to leverage Visual Studio to analyze variable values as you execute your code.  Very useful!

First, within Internet Explorer, uncheck “Disable script debugging  (Internet Explorer)” and “Disable script debugger (Other)”

Next, add following code before any code you would like to debug.

debugger;

 

CRM 2011 – Three fold increase in CRM jobs this year

If get a number of emails from recruitment consultants each week, most of them are totally inappriopriate to such an extent I wonder why they have sent them to me, did they look at my cv/profile on linkedin?  Usually it smacks  of desperation, recruitment consultants spraying out emails to any email address they can find.

Any today I got an update from recruitment consultant who specialises in CRM.   I thought it was interesting he was sending out emails updating them on the CRM market, it seemed to add some kind of value, which is quite unusual for recruitment consultants.  The email had some observations about the CRM market which seemed to back my opinion of the state of the CRM market.

I figured that since Microsoft has released CRM 2011, which contained a number of popular enhancements like sharepoint intergration/document management, dashboards and a easier to use UI it would lead to more CRM work because they would be new customers and customer upgrading.

I also thought with the big promotion from Microsoft CRM and the in particular the cloud offering, especially consider the very competitive pricing strategy Microsoft is using.  This would also lead to an increase in CRM 2011 deployments, snaffling quite a few customers from salesforce.

Anyway here are some of the comments from the email, I would of course take some of it with a pinch of salt because the goal of the letter is to obviously encourage people to move and apply for jobs and what’s likely to that, it’s by telling you there are loads of jobs and they are paying top dollar, still we can hope

CRM Desk team has noticed a three fold increase in demand for skilled candidates and now is the time that professionals within Dynamics CRM are moving for the increases in salaries, packages, better career prospects and further development training opportunities.

The UK Perm market, this year has been crazy! In the best way possible, candidates are looking at the fastest and largest growing companies and packages than ever before with “paid 2 gain” certifications and extra training also on offer, This may have alot to do with the product growth and the platforms adaptability or as predicted the rise in demand after January’s CRM 2011 product launch,

 

The letter also gave a bit of insight to which sectors are growing


 

Firstly the sectors and verticals that seem to be most profitable for MS Dynamics CRM candidates to be working in are financial, media, Tel-com & Niche Energy. with Legal and Govt looking to be on the increase / growing MS CRM markets. This is due to Central Govt seeing the value of streamline business processes and saving money through investment into cloud or integrated customer relationship management systems.

Microsoft in America are strategically looking to target and dominate the legal sector as large and small law firms often outsource many different ERP & CRM and legal systems when Microsoft’s offerings can be easily and highly bespoken to fit into and benefit them whilst all importantly saving money.


CRM 4 – Ultimate Dynamics CRM Tools List

Although I have been working with CRM 2011, I  still have to work with CRM 4 projects.  It’s quite unusual now because a lot of the tools that worked in CRM 4 don’t work in CRM 2011 so you need to keep two sets of CRM tools

So today I was using the Javascript manager tool to extract the Javascript from an organisation and see what entities had Javascript.

So today I found the ultimate list of Dynamic tools for CRM 4, which you can find here

http://vidmar.net/weblog/archive/2010/05/06/ultimate-dynamics-crm-tools-list.aspx

It is a fantastic list of tools for CRM 4, one or two even work with CRM 2011

Here are my are my top five from the list.  I would also recommend looking at the blog because there are some interesting comments as well.

CrmDiagTool4 for Microsoft CRM 4.0

This tool makes starting tracing and turning on DevError for CRM really easy. You don’t need to manually edit web.config files, do it by clicking a button.

Customization Comparison Utility

This utility will do side-by-side comparison between two cusomization.xml files. Useful for documenting changes, spotting bugs and much more

CRM Trace Log Viewer

Simple but very useful tool that lets you filter and resolve users in Dynamics CRM trace files.

Form JavaScript Manager

If you do lots of JavaScript customizations, you know the editing of script is not easy within CRM. Form Javascript Manager is one way of solving those issue. It helps you with export/edit/import cycle of editing.

MS CRM Javascript Intellisense Generator

This tool will generate .js files for all entities. If you edit your JavaScript in Visual Studio, the editor can use this file for autocomplete.