Technical Fun

Bringing CRM 3.0 Picklist Content To See The World

Posted on: November 19, 2007

Have you ever desired to pull the content of your CRM picklist attributes and show it to the world using other presentation method? No? really? why? hhh… so sad.
But for those of you who bears the same desire as mine, here’s a little help.

Remember that oMds is an instance of CRM Metadata web service.

private PicklistAttributeMetadata getPickListValue(string entityName, string pickListAttributeName)
{
AttributeMetadata amd = oMds.RetrieveAttributeMetadata(entityName,pickListAttributeName);
PicklistAttributeMetadata pl = (PicklistAttributeMetadata)amd;
return pl;
}

As you see, that method will return PicklistAttributeMetadata, which containes Options attribute, that you can iterate later, like this:
Assume that you have an entity named “new_suppliers” and a picklist attribute called “new_supplierstype”.

PicklistAttributeMetadata pam = getPickListValue("new_suppliers","new_supplierstype");
foreach (Option o in pam.Options)
{
lstAttribute.Items.Add(o.Description); //i.e: you got a listbox called lstAttribute and decided to bind the picklist to it.
}

Ok? No? eh? Why ..? hhh .. so sad..

Advertisements
Tags: ,

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: