70515 – JQUERY Introduction videos

for the 70515 .NET 4 exam you need to know about Jquery and although I have gone through the chapter in the book I thought it would be useful to do a bit more research into the topic, so I went and found a few videos on youtube.

Javascript and Jquery

here is an hour long video on JQUERY by a 12 year old!!!

CRM 2011 – How to select an Id in a QueryExpression

As I have been converting all my LINQ queries into QueryExpressions so my plugins can work on CRM 2011 Online.  It was quite annoying to find LINQ wasn’t compatible with CRM 2011 online and the sandbox.  I don’t really understand why, I assume it’s something to do with the transactions.

Today I was trying to select the id of an entity and use an entity reference  object to make sure I had got the right one.

The basic scenario is I had an entity which had a Entity Reference to another object and I wanted to use that to return the whole entity.

I initially had a mind blank trying to remember what the ID field was (and it’s not just id) but then I worked it out that it’s the entity name with id added to end of it.  So I was looking for a hosk_candidate entity, I add the id to the end to get

hosk_candidateid

The other little gotcha was when you use the EntityReference to get the id you have to do

Id.id

 public hosk_candidate getCandidateQuery(IOrganizationService service, EntityReference id)
        {
            try
            {
                ConditionExpression condition1 = new ConditionExpression();

                condition1.AttributeName = "hosk_candidateid";
                condition1.Operator = ConditionOperator.Equal;
                condition1.Values.Add(id.Id);

                FilterExpression filter1 = new FilterExpression();
                filter1.Conditions.Add(condition1);

                QueryExpression query = new QueryExpression("hosk_candidate");
                query.ColumnSet = new ColumnSet(true);
                // query.ColumnSet = new AllColumns();
                query.Criteria.AddFilter(filter1);

                EntityCollection result1 = service.RetrieveMultiple(query);
                IEnumerable<hosk_candidate> candidates = result1.Entities.Cast<hosk_candidate>();
                hosk_candidate candidate = (hosk_candidate)returnOne(candidates);

                return candidate;

            }
            catch (FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault>)
            {
                // You can handle an exception here or pass it back to the calling method.
                throw;
            }
        }

CRM 2011 – How to check the context message in a plugin

A little tiddler of a blog post today but still a useful one.

I was writing a plugin for an entity and I wanted to use some of the same logic for a create message and for an update.

You will need to add two different steps but can still point these to the same plugin.  Then in the plugin you can check the context.MessageName to see what message has been passed into the plugin and then do different actions depending on the result.  I have sent the message to upper to take case out of the equation.

here is the code in an if statement

if (context.MessageName.ToUpper() == “CREATE”){

}

if (context.MessageName.ToUpper() == “UPDATE”) {

}

CRM 2011 – Benefits of Hosting CRM Dynamics Online

I found this article called Nine Benefits of Hosting Dynamics and I have pasted the main benefits of the article below.  The original article I think was on a Dynamics GP.

This is an interesting article because although Microsoft is pushing CRM Online in a big way, I usually only hear that it’s good because Microsoft are advertising it and because the subscription costs at the moment are quite cheap (combined with Microsoft offering a good deal to move from Salesforce).

This is a good list of benefits, I think the most important benefit is you don’t have a large initial outlay when you have to buy servers and software if you had an on premise installation.  Also you would have to support that server yourself where as with CRM online you get free support, free upgrades and the costs split over many months.  Another benefit is I think Microsoft offers some kind of guarantee to basically ensure your CRM access be interrupted.

here is the article

Nine Benefits of Hosting Dynamics

These are the benefits that our customers generally experience when they decide to host their Dynamics systems online:

24/7 support – Basic IT support to ensure that users can always have access to the system.

Minimize/eliminate upfront capital costs – This frees up working capital to better serve your customers, e.g. holding higher levels of inventory to minimize stock-outs, having the ability to extend more credit.

Minimize/eliminate additional IT resources – IT resources can be focused on systems and tasks that increase business value and provide a competitive advantage.

Management of the OS, Service Packs, and security – Systems are maintained at the highest level of performance and security available.

Managed backups (daily, weekly, monthly & annually) – Ensures that your critical business data is being regularly backed up, the backup/restore mechanisms are routinely tested, and reasonable and practical disaster recovery plans are in place to ensure business continuity.

No additional consulting costs for Service Packs, upgrades, hot fixes and enhancement releases – Users always have access to the latest software and systems are kept up to date with no additional impact on operating budgets.

Applications accessible to employees at multiple locations (on the road or from home) – Remote and secure connectivity for users from wherever they want to use the system.

Predictable monthly IT Costs – No surprises.

Quick deployment – Quicker time to value and ROI.

How many CRM installations fail – Google gives some answers

I found this interesting article, I like the way the writer is using Google to get some information (un scientifically of course) by seeing how many results came back when searching values using google.

I did a couple of searches myself

crm installation failure

7,570,000

crm 2011 installation failure

3,650,000

crm 4 installation failure

50,100,000

This was the original article

7.5 Million CRM Failures on Google Search

Here is an interesting set of numbers. Totally unscientific, but interesting. I searched for “Microsoft” in Google and got 1.05 billion results. Then I repeated the search and entered “Microsoft failure” and got 36.3 million results. Sounds high? Not as high as some of their competitors. The biggest surprise: Salesforce.com is the clear winner of this (unscientific) comparison. See for yourself and check your company’s failure percentage.

CRM 86.3 million results
CRM Failure 7.5 million
Failure percentage: 8.7%

Salesforce.com 36 million results
Salesforce.com failure 701,000 results
Failure percentage: 1.9%

Microsoft 1.05 billion results
Microsoft failure: 36.3 million results
Failure percentage: 3.46%

SAP 155 million results
SAP failure 18.6 million results
Failure percentage: 12%

Oracle 162 million results
Oracle failure: 24 million results
Failure percentage: 14.8%

CRM 2011 – How to do Like statement in QueryExpression

I was trying to do a like statement in a query expression and it took me a while to work out how to do it.
the first thing you do is use the Like condidationOperator and then you add the value.  Like an SQL query you need to use
the % wildcard and add this to the text string
            condition1.Operator = ConditionOperator.Like;
            //ConditionOperator.Like
            condition1.Values.Add(id.ToLower() + "%");

the other interesting aspect of the sample code below is I cast the results

 IEnumerable<hosk_candidate> newCandidates = result1.Entities.Cast<hosk_candidate>();

The reason I had to do this was because I was changing how I selected the data from CRM from LINQ queries to
QueryExpressions because LINQ statements cannot be used in CRM Online.

 private IEnumerable<hosk_candidate> selectCandidates(hosk_candidate candidate, string id)
        {

            ConditionExpression condition1 = new ConditionExpression();
            condition1.AttributeName = "hosk_candidatehoskid";
            condition1.Operator = ConditionOperator.Like;
            //ConditionOperator.Like
            condition1.Values.Add(id.ToLower() + "%");

            FilterExpression filter1 = new FilterExpression();
            filter1.Conditions.Add(condition1);

            QueryExpression query = new QueryExpression("hosk_candidate");
            query.ColumnSet.AddColumns("hosk_candidatehoskid");
            query.Criteria.AddFilter(filter1);

            EntityCollection result1 = service.RetrieveMultiple(query);
            IEnumerable<hosk_candidate> newCandidates = result1.Entities.Cast<hosk_candidate>();

            return newCandidates;
        }