Had a clear out last night and decided i would start putting some of my past and current bits online, these will be pieces of codes, tools that either i have used or still use in projects. Download them and do what you want with them, Ive started with two classes that i use repeatedly again and again..

Click here to go to the new projects area....enjoy

I came across a issue today that i never had thought about before. CRM allows you to sort a CRM Picklist in its base language only. This means that all other languages will see a more jumbled up list of Picklist values.

The client asked if it was possible to sort the other languages alphabetically as this was causing a lot of grief in the training,

Came up with this reorganises the picklist on the onLoad event.

sortPicklist =function(fld)
{
var field = document.getElementById(fld);
var ops= field.Options;
var nOptions = new Array();

for (var i = 0; i < ops.length; i++)
{
nOptions[i] = ops[i];
}
nOptions.sort(compare);

//Clear Picklist
field.innerHTML = "";
field.Options = nOptions;
}

compare = function(a,b) {  
if (a.Text< b.Text)   
  return -1;  
if (a.Text > b.Text)    
  return 1;  
return 0; }

//Call the function using the picklist name
sortPicklist("new_mypicklist");

Developing a solution involving picklist and language translations and i needed a way to clear the picklist quickly.

The obvious way was to use the DeleteOption whilst iterating through the Option array.

This was rather slow - so i went straight for the kill.

crmForm.all.new_picklist.innerHTML = "";

Clearing the innerHTML basically clears all the options HTML within this control.

The date value that comes in the results of a FetchXML request cant really be used in its form as its just a UTC sting.... really useless if you want to do some Date Comparision work on it.

if you use ParseDate(datefromfetchxml) it will convert it into a javascript date for use on your form.


Warning: Division by zero in /var/www/vhosts/mscrmtech.com/httpdocs/templates/rt_quasar_j15/html/com_content/section/blog.php on line 55

More Articles...

Page 10 of 31

10