CRM 2011 – No Default values for fields on forms – Javascript to the rescue.

[tweetmeme source=”BenHosk” only_single=false]

I was working today setting up some fields on a form and then I noticed that my plugin (auto number plugin for CRM 2011!!!) failed.

It was because I was expecting a value in a field which stored a whole number.  This number was used to specify the number of digits the counter should be padded with zeros.

The basic problem was I was trying to convert a null into an int which obviously doesn’t work.  I thought I would supply a default value for the field but then was stupified by the fact there is not default value setting in CRM 2011.  Unless you are selecting a dropdown list which you can specify a default value then any whole numbers, decimals, strings don’t have a default value setting, WHY!!

I thought maybe CRM 2011 could supply a screen like the workflow form screens which would allow you to set default values on the form.

Instead I had to put some code in the OnLoad of the form to add a zero value.  Although this isn’t really necessary because by changing a field to Business Required the user would have to put in a value before they would be able to save the form but it made it easier for the user if I already put in a zero value for them.

It seems such a basic thing for CRM 2011 not to include much like the Auto Number/counter.  Why have they included this functionality in some entities but not in all.

This is the code I put into the onload event

function OnLoad() {

//var accId = Xrm.Page.getAttribute(“hosk_clientid”).getValue();

//var candidate =  Xrm.Page.getAttribute(“hosk_candidateid”).getValue();

if (Xrm.Page.getAttribute(“hosk_extension”).getValue() == null) {

Xrm.Page.getAttribute(“hosk_extension”).setValue(0);

}

if (Xrm.Page.getAttribute(“hosk_revision”).getValue() == null) {

Xrm.Page.getAttribute(“hosk_revision”).setValue(0);

}

}

Paternity Leave can Encourage Good Practices

I wrote my first blog entry for the Crimson company blog this week, you can go here to read it

I will be interested to see the content from other work colleagues

Paternity leave promotes good practice

One person at work is on the verge of paternity leave; the baby is now eight days overdue and doesn’t seem to be in any rush to enter the world, obviously this isn’t the good practices I refer to in the title.

Whilst Almost Dad is getting things prepared he emailed a few people asking us to configure outlook so a number of people can monitor the Support Desk emails/issues whilst he is away.  This highlighted to me a good practice Companies should get into; don’t rely on just one person.

I always view it as a danger when there is only one person working on a project and because that person is the only person working on it, he doesn’t bother to document things because he knows it all off by heart.  This system works fine until that person is off ill, goes on holiday and then someone else has to step into the breach and work out how to do anything.

I never like to store information in people; I also like to have it written down on the intranet.  Crimson creates an intranet site/area for each customer project we have and then we store useful information here.  This is vital when you have different people working on smaller parts of a project and need to learn about the project, the customer contacts, the server locations etc.

It’s also important you encourage everyone to keep this information up to date because keeping good up to date records is a habit and if people start to get out of it you only usually notice it when it is a problem and you can’t figure out how to do something or where a vital part of a project is kept.

I have thanked myself on a number of occasions when I have found I have documented a procedure which I had forgotten how to do.  Documentation is particularly important in support projects which might not have any activity for a while and then suddenly someone will have to investigate a problem.  I view project documentation as a knowledge/brain dump for myself and other people who will be working on the project in the future.

It can also save different people solving the same problem/issue, once someone has a solution then other people can follow the documentation solution which can save hours and sometimes days of diagnosis.

In the example I used at the start of this blog post, we already had a few people monitoring the support Desk inbox (me being one of them) but the email acted as a good reminder for people and sent out instructions for more people to keep an eye on the Support Desk inbox.  It got me thinking information and projects shouldn’t just be reliant on knowledge which is held only in one persons head, get them to document it.

 

 

 

CRM 4 Error – Invalid Action – the selected action was invalid

[tweetmeme source=”BenHosk” only_single=false]

today I got this error when trying to login to CRM

Invalid Action – the selected action was invalid.

A particularly helpful message I thought.  Alarm bells started to ring louder when all the CRM organisations on that server were bringing up the same message!

I tried restarting IIS which did nothing

I checked the disk space (did I accidently leave logging on, which reminded me to turn it off on another server not before there was 23 gigs of tracing already created!!!)

I then googled around a bit and found this blog post

The solution was to restart the Microsoft CRM Asynchronous Processing Service and then hey presto all was well again.

I think restarting CRM Async service is a bit like rebooting your computer, it’s always worth doing in the hope of an easy fix.