Login / Register  search  syndication  about

          Kris Halsrud's Blog

Kris Halsrud on development and Integration with CRM and Development

Utilizing the Picklist assembly to get Picklist details in SalesLogix 7.5 Web

While there are many ways of querying data in the SalesLogix entity model, including using the DataServices, or IQuery to run a direct query to the database, SalesLogix also has provided a Picklist assembly for working specifically with picklists.  If you take a look at the entity model you will notice that there is no IPicklist assembly.  Working with Picklists are a common enough thing for any SalesLogix developer.  Wether it be populating a control with picklist values or doing a lookup to get picklist's text, short text, picklistid, or itemid values, all of these things can be accomplished by using the Sage.SalesLogix.Picklists assembly.

The picklist assembly defines a Picklist class (Sage.SalesLogix.PickLists.PickList).  This class exposes the typical properties about a picklist entity including:

  • Code
  • CreateDate
  • CreateUser
  • DefaultIndex
  • Id (same as ItemId)
  • ItemId
  • ModifyDate
  • ModifyUser
  • PicklistId
  • Shorttext
  • Text
  • UserId

It also contains several methods that can be called to return a specific Picklist object or a collection of them.

Lets take a look at one I recently had to use.

In the Support area of SalesLogix (Tickets in particular) there are several fields that store the picklist code rather than the text value.  One of these is Ticket Status.

Now if you tried to run a server side script to get the contents of the Ticket Status' picklist such as

if(pklStatusCode.PickListValue == "Open")

It would never return true.  This is because since the picklist stores the picklist code instead of the text, what it actually would need to say is

if(pklStatusCode.PickListValue == "k6UJ9A000039")

In this example the ID represents the picklist's ItemId value, which is the unique value for the item in the picklist table. Since picklist ItemID's can be different between databases (They are sequentially generated at the time the picklist entry is created based on the key index of the database at the time) it is not a good idea to hard-code a specific value.

So how can we do a quick lookup to get what the correct ItemID value is?  Use the Sage.SalesLogix.PickLists assembly, of course!

Lets take a look at one method in particular, called "GetPicklistItemByName".  This method accepts two inputs, the name of the picklist containing the value you want to query and the text value of the item you want to query.  It ouputs a Sage.SalesLogix.Picklists.Picklist object.  Lets take a looks:

Sage.SalesLogix.PickLists.PickList er = Sage.SalesLogix.PickLists.PickList.GetPickListItemByName("Ticket Status","Closed");

So in this sample I am going to get a Picklist object returned to me that represents the picklist item in the "Ticket Status" picklist where the item's text = "Closed".  Now with my object I can then query any of its attributes.  Here is full sample:

Sage.SalesLogix.PickLists.PickList er = Sage.SalesLogix.PickLists.PickList.GetPickListItemByName("Ticket Status","Closed");
if( pklStatusCode.PickListValue == er.ItemId)

There you have it.  A very easy way of getting the picklist details about a particular item.  Spend some time looking at this assembly.  There is a lot it can offer when you need to work with picklists.

What's This?
Bookmark and Share

About Kris Halsrud

   Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.


Related Content
   SalesLogix 7.5.2 Speed Issues - How To Find the Slowdown
At times I have been asked how can I increase the performance of SalesLogix. For systems using SQL2005
Posted on Aug 13, 2010 by Mark Duthoy to SalesLogix Support
 
   Troubleshooting the SalesLogix Disconnected Web Client
Last week I blogged on the deployment of the Disconnected Web Client. Today's post discusses the iss
Posted on Aug 06, 2010 by Mark Duthoy to SalesLogix Support
 
   Restoring Deleted SalesLogix Sales Processes
If someone has deleted an existing SalesProcess and you need to restore it you can follow this guide.
Posted on Jul 23, 2010 by Mark Duthoy to SalesLogix Support
 
   Attachments Missing After Creating A New SalesLogix Remote User Database
This problem is usually due to not setting the Send Attachments option when creating a new database
Posted on Jul 09, 2010 by Mark Duthoy to SalesLogix Support
 
   Adding the standard SalesLogix Save prompt to an Insert Screen in the SalesLogix Web Client
If you have used the web client for SalesLogix one of the things that you will have noticed is that when
Posted on Jul 06, 2010 by Kris Halsrud to Kris Halsrud's Blog
 
Comments

 

Ryan Farley said:

Excellent post Kris.

June 24, 2009 12:17 PM

Leave a Comment

(required)  
(optional)
(required)  
Add
All contents Copyright © 2010 Customer FX Corporation
Customer FX Corporation
2324 University Avenue West, Suite 115
Saint Paul, Minnesota 55114
Tel: 800.728.5783

  Follow @CustomerFX on twitter
Follow the best news, tips, and articles
  Subscribe to Customer FX on youtube
Watch SalesLogix tutorial videos from Customer FX
Login / Register