Monday, July 19, 2010

CRM 4.0 Enhancing Picklists presentation layer

Picklists are usually used to provide a short range of predefined options that further describe our data. To make them usable it’s suggestible to keep the number of Picklist options to a minimum. Although a Picklist presentation layer is functional data is not always that boring and deserves a better re-presentation.

I personally think that controls should convey more emotions and strengthen bond between what is showing and how it’s shown. Take for example a simple Picklist that has values 1-5 that describe the account rating or a Picklist of shipping methods with well known company names. No doubt presenting the following control to the user makes more sense than just selecting a number.

The concept used in this example can be developed further to support more advanced scenarios. The nice thing about it is that most of the bits that handle the actual show and hide of the Picklist menu can be reused. So if you find yourself needing to create a more complex Picklist you should center most of your effort by overriding the buildPopup function (see code).

The code exposes most of the styling attributes which means you don’t have to tear it apart if you feel like redecorating ;+).

In order to facilitate the construction of options and their respective images the code uses a simple technique that accepts an Image base URL and utilizes the picklist id to identify specific images folder. The image names represent their index i.e. 0.gif, 1.gif, 2.gif and so on. If need to use option’s value instead you must also change the code that constructs the image URL.

| -- ISV
|-- IMGPL (this is the ImageBaseUrl)
|-- selected.gif (A small arrow that points to the selected option)
|-- gi_rating (This is the Picklist id)
|-- 0.gif (Empty option X image – index 0)
|-- 1.gif (first option – index 1)
|-- 2.gif (second option – index 2 and so on..,)

Eventually the image URL is http://servername:port/iSV/IMGPL/gi_rating/1.gif
Feel free to comment.

String.prototype.Format = function( args )
return this.replace( /\{(\d{1})\}/ig , function match(){return args[arguments[1]];});

function ImagePicklist(picklistId)
var ipl = this;

if (!(ipl.Picklist = crmForm.all[picklistId]))
return alert("Picklist is missing");

if (ipl.Picklist.Disabled)

ipl.ImageBaseUrl = "/ISV/IMGPL/";
ipl.HoverStyle = {Color: "#FFFFFF",Background: "#000000"}
ipl.HasEmptyOption = true;
ipl.Height = 213;
ipl.BackgroundColor = "#FFFFFF";
ipl.Scroll = true;

ipl.Picklist.ondblclick = function(){show();}
ipl.Picklist.onmousedown = function(){show();}
ipl.Picklist.onfocusout = function()
ipl.Picklist.Popup.document.body.innerHTML = "";

function show()
ipl.Picklist.Disabled = true;
var left = ipl.Picklist.Position.X;
var top = ipl.Picklist.Position.Y;
var width = ipl.Picklist.offsetWidth;
var height = ipl.Height ,top ,width ,ipl.Height ,document.body);
setTimeout(function(){ipl.Picklist.Disabled = false;},100);
return false;

ipl.MouseOver = function(option)
{ = ipl.HoverStyle.Background; = ipl.HoverStyle.Color;

ipl.MouseOut = function(option)
{ = ipl.BackgroundColor; = "#000000";

ipl.Onclick = function(option)
ipl.Picklist.selectedIndex = option.index

function getPosition(control)
var left = 0;
var top = control.offsetHeight;

do {
left += control.offsetLeft;
top += control.offsetTop;
} while (control = control.offsetParent);

return {X:left,Y:top}

function buildPopup()
ipl.Picklist.Position = getPosition(ipl.Picklist); = ipl.BackgroundColor;

var div = document.createElement("DIV"); = "overflow-y:{0};height:{1}px;".Format([(ipl.Scroll?"scroll":"hidden"),(ipl.Height-13)]);

for (var i=(ipl.HasEmptyOption?0:1);i< ipl.Picklist.options.length;i++)
var option = ipl.Picklist.options[i];

var item = document.createElement("DIV");
item.index = i;
item.onmouseover = "document.ImagePicklist.MouseOver(this);";
item.onmouseout = "document.ImagePicklist.MouseOut(this)";
item.onclick = "document.ImagePicklist.Onclick(this)";
item.title = "Value = {0}".Format([option.value]); = "25px" = "hand";

var selItem = null;
if (option.selected)
selItem = document.createElement("IMG"); = "16px"; = "16px";
selItem.src = "{0}selected.gif".Format([ipl.ImageBaseUrl]);
selItem.align = "middle";
selItem = document.createElement("SPAN");
selItem.innerHTML = " "; = "16px";

item.appendChild(document.createTextNode(" "));

var img = document.createElement("IMG");
img.src = "{0}{1}/{2}.gif".Format([ipl.ImageBaseUrl,,i]);

var optText = null;
if (option.selected)
optText = document.createElement("B");
optText.innerText = " {0}".Format([option.innerText]);
optText = document.createTextNode(" {0}".Format([option.innerText]));

ipl.Picklist.Popup.document.body.innerHTML = div.outerHTML;

{ //Initialize

ipl.Picklist.Popup = window.createPopup();
/* A reference from the window popup to ipl */
ipl.Picklist.Popup.document.ImagePicklist = ipl;

var popUpBodyStyle =;
popUpBodyStyle.border = "1px solid gray";
popUpBodyStyle.padding = 0;
popUpBodyStyle.margin = 5;

function OnCrmPageLoad()

window.ctcPicklist = new ImagePicklist("customertypecode");
ctcPicklist.ImageBaseUrl = "/ISV/IMGPL/";
ctcPicklist.HoverStyle = {Color: "gold",Background: "#FF3454"}
ctcPicklist.HasEmptyOption = false;

window.accPicklist = new ImagePicklist("accountcategorycode");
accPicklist.Height = 85;
accPicklist.Scroll = false;
accPicklist.BackgroundColor = "yellow";

window.graPicklist = new ImagePicklist("gi_rating");
graPicklist.Height = 165;
graPicklist.Scroll = false;
graPicklist.HoverStyle = {Color: "navy",Background: "#FFFFFF"}



Paul said...

How do you implement this?

DO I need to copy this code into the onload event for one of my CRM Forms?

Do I have to tweak the code at all for my picklist name?

Microsoft Dynamics CRM said...

I think it's easy to implement in CRM 2011. As we know the CRM 2011 is the latest version than CRM 4.0.

Also the "ImageBaseUrl" was not properly pick the image some time. Should I give the full path?

Anonymous said...

Read all the related Posts:

64 Software Manual Testing Interview Questions

Answers To Common Job Interview Questions

Behavioral Questions In Interviews

Questions to Ask at an Interview

Competency based Interview Questions

Read all the related Posts:

How to avoid missing defect in Software Testing?

Defect Management Process

What is the difference between a Test Strategy and Test Plan?

Beginners Guide to ETL Testing

Step by step guide from Test Case Development to Test Execution

microsoft dynamics crm online training said...

its very easy to implement in crm 2011 version better then new version crm 2013

My Sap Gurus said...

Best CRM Online training with quality study materials. Click here to know more about it.

oracle fusion procurement training said...

Commenting on a weblog is a painting. accurate feedback create members of the family. you’re doing brilliant work. very pleasant I genuinely like your weblog......
oracle fusion procurement online training

oraclefusion said...

Thanks for sharing the useful information and good points were stated in the blog which is very useful and for the further information about the oracle visit our site
Oracle Fusion Financials Training

oracle EBS said...

Nice article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.\
Thanks and regards,
Oracle EBS Online training

Calfre India said...

Oracle Fusion financials online training institutes is available at, you just need to provide your interested coaching center location and course you prefer to learn with this information we can provide you the institutes list which are top rated in that particular area. thank you

Oracle Fusion Financials online Training

Oracle fusion Financials Trainin

Blogger said...

BlueHost is ultimately the best website hosting company with plans for all of your hosting requirements.

Windy Dacosta said...

Many issues mention about cockfight in philipine, we are from ayam bangkok jengger wilah want to explain that. You can read our article. Thanks.

Panggang Ayam Marketing said...









ananthinfo said...

nice post..
SAP BUSINESS ONE for Dhall solution
ERP for food processing solutions
ERP for masala solution
SAP BUSINESS ONE for masala solution
ERP for Rice mill solution

Martha said...

Very nice article. I found very useful tips from your article.

Unknown said...

I am really admired for the great info is visible in this blog that to lot of benefits for visiting the nice info in this website. Thanks a lot for using the nice info is visible in this blog.
Java training in chennai | Data Science Training in Chennai | DevOps Training in Chennai

zara said...

This is the best blog with highly informative about Data Science Training in Chennai, Devops Training in Chennai

ananthinfo said...

nice post..Sap B1 Companies in Chennai
Sap B1 Company in Chennai
Sap B1 Partners in Chennai

cloud ace said...
This comment has been removed by the author.
madduri jagadeesh said...

good information and nice article
DevOps Training in Hyderabad
Salesforce Training in Hyderabad
SAP ABAP Online Training
SEO Training in Hyderabad

Digital Floats said...

Great Article. Thanks for sharing info.

Digital Marketing Course in Hyderabad

Digital Marketing Training in Hyderabad

AWS Training in Hyderabad

Workday Training in Hyderabad

Bannu Babu said...

Nice Article ..Thanks for providing information that was worth reading & sharing
ielts coaching in Hyderabad
Machine Learning Course in Hyderabad
Power bi training Hyderabad
Python training in Hyderabad

DevOps Online Training said...

Very good information about DevOps clear explanation thanks for sharing
anyone want to learn advance devops tools or devops online training visit:
DevOps Online Training
DevOps Training institute in Hyderabad
DevOps Training in Ameerpet

digital abhishek said...

Great article thank you.
Big Data Hadoop Training in Hyderabad
Data Science Course in Hyderabad
AngularJS Training in Hyderabad
Advanced Digital Marketing Training Institute in Hyderabad

mani said...

awesome article thanks for sharing

devops online training

python online traning

power bi online traning

machine learning online course

SAHASRA R said...

Thanks for sharing knowledgable article,all greetings keep on posting
AWS Training in



Marketing Training in Hyderabad

Big Data

Hadoop Training in Hyderabad

Digital Marketing

Course in Hyderabad

Training said...

Very Informative, Thanks for Sharing.

Digital Marketing Courses in Hyderabad

SEO Training in Hyderabad Ameerpet

SAP ABAP Training Institute in Hyderabad

Salesforce CRM Training in Hyderabad

digitalmrk said...

Usefull Article. Thanks for sharing info.

Digital Marketing training in Hyderabad

IELTS training

in hyderabad

sap sd online


sap fico online


Shaikfarha said...

Very interesting, good job and thanks for sharing information .Keep on updates.

Affiliate Marketing Training in Hyderabad

Online Reputation Management in Hyderabad

Email Marketing Course in Hyderabad

E-Commerce Marketing Training in Hyderabad

Digital shree said...

The best Article that I have never seen before with useful content and very informative.Thanks for sharing info.

Social Media Marketing Training in Hyderabad

Adwords Training in Hyderabad

Google Analytics Training in Hyderabad

Google AdSense Training in Hyderabad

Digital Nagaraj said...

Great Article. Thanks for sharing info.

Digital Marketing Course in Hyderabad

Top Digital Marketing Courses with the live projects by a real-time trainer

line Digital Marketing Courses in Hyderabad

SEO Training in Hyderabad

hahaha said...

Link Alternatif S1288poker

S1288poker Judi Poker Online

CS S1288poker

S1288poker Indonesia

mytrainingsoline said...

Nice observation and good article,thankyo for sharing your knowledge,keep posting such information that's helpful to others
data science online training
best data science online training
data science online training in Hyderabad
data science online training in india

piyush kumar said...

thanks for this information...

Manga Sites

Arif qadri said...

I have no words for your praise it was really praiseworthy stuff and great information & all amazing. I'm glad to know about keep sharing as valuable content with us.

Sanoritha said...

Hi, Thanks for sharing nice information. Anyone interest to learn Best Digital Marketing Course in Ameerpet . Best institutes is Hyderabad Digital Marketing Institutes they provide all concepts SEO,SMM,SMO ADwords, Affiliate Marketing.

Chandu Chinnu said...

Very Interesting, Good Post Keep it up
Here Realated:
Full Stack online Training

Full Stack Developer Online Training

Full Stack Training

Unknown said...

Thanks for the post.
aws training in hyderabad

meenati said...

Such an ideal piece of blog. It’s quite interesting to read content like this. I appreciate your blog
Data Science Certification

sakshta rasal said...

Thanks for sharing information I must say very informative blog post. Keep it up!!
digital marketing classes in baramati | java course in baramati | white label trucking app solution | php classes in baramati

sakshta rasal said...

Thanks for sharing information I must say very informative blog post. Keep it up!!
digital marketing classes in baramati | java course in baramati | white label trucking app solution | php classes in baramati

digitalsourabh said...

I am really happy to read your blog. your blog is very good and informative for me.
Your blog contain lots of information. It's such a nice post. I found your blog through my friend if you want to know about more property related information please check out here. With the experience of over 3 decades, Agrawal Construction Company is the biggest and the best builders in bhopal and the trust holder of over 10000 families. Agrawal Construction Company Bhopal is serving society, building trust & quality with a commitment to cutting-edge design and technology. Agrawal Construction Company's vision is to 'building trust & quality' which extends to developing residential, commercial and township projects in all the directions of the beautiful City of Lakes Bhopal and hence it is among the top builders in Bhopal. Currently, it has four residential such as Sagar Pearl, Sagar Green Hills, Sagar Landmark and Sagar Eden Garden.

Eiliza45 said...

I love this post.

โปรโมชั่นGclub ของทางทีมงานตอนนี้แจกฟรีโบนัส 50%
เพียงแค่คุณสมัคร Gclub กับทางทีมงานของเราเพียงเท่านั้น
สมัครสมาชิกที่นี่ >>> Gclub online

lggy1688 said...

Very cool!

เว็บไซต์คาสิโนออนไลน์ที่ได้คุณภาพอับดับ 1 ของประเทศ
เป็นเว็บไซต์การพนันออนไลน์ที่มีคนมา สมัคร Gclub Royal1688
และยังมีเกมส์สล็อตออนไลน์ 1688 slot อีกมากมายให้คุณได้ลอง
สมัครสมาชิกที่นี่ >>> Gclub Royal1688

Anonymous said...

Thank you so much for the sharing it was useful and very informative. We're leading interior designers in chennai, we do all interior contract work.

Packers and Movers said...

Wooow.. Nice post Thank your for sharing Such type of Information.
We are Saaya Relocation Packers and Movers Ahmedabad is Trusted and Most verified movers and packers service provider in All over India.
Packers and Movers in Ahmedabad,
Packers and Movers in Bhuj,
Packers and Movers in Porbandar,
Packers and Movers in Palanpur,
Packers and Movers in Surat,
Packers and Movers in Vadodara,
Packers and Movers in Porbandar,
Packers and Movers in Palanpur,
Get Free Quote.
Thank You.

kavithasathish said...

Thanks for posting this information it really useful for everyone.
French Classes in Chennai
french courses in chennai
Spoken English in Chennai
TOEFL Training in Chennai
pearson vue
german language course
French Classes in Velachery
French Classes in Adyar

DevOps Training said...

Nice post Thank your for sharing Such type of Information. Keep sharing more post.
Devops Training | DevOps Training in Hyderabad | DevOps Online Course

Free Career Guide said...

Nice Post thanks for the information, good information & very helpful for others. For more information about Why need Free Online Career Counselling & What Is Career Counselling? Career Counselling is a process that focuses on helping Click Here to Read More

anusha said...

MEAN Stack Training in Chennai MEAN Stack Training in Chennai with real time projects. We are Best MEAN Stack Training Institute in Chennai. Our Mean Stack courses are taught by Industrial Experts which would help you to learn MEAN Stack development from the scratch.

Unknown said...

Great blog created by you. I read your blog, its best and useful information.
AWS Online Training
Devops Online Training
Apllication Packaging Online Training

IT Trainings said...

Just now I read your blog, it is very helpful nd looking very nice and useful information.
Digital Marketing Online Training
Servicenow Online Training
EDI Online Training

yuvanthi said...

Thanks to the admin you have spend a lot for this blog I gained some useful info for you. Keep doing.
microsoft dynamics crm training institutes in chennai
microsoft dynamics training
CCNA Training in Chennai
Salesforce Training in Chennai
gst classes in chennai
microsoft crm training
web designing training in chennai
Tally Course in Chennai