jump to navigation

Dynamic Picklists — Well Sorta June 20, 2010

Posted by richeaton in SalesLogix General.
trackback

I know it has been some time since I last wrote in this blog however, I have not been doing any real development work with SalesLogix Web. I have been focusing on some LAN client upgrades and some customizations for clients who have not yet moved to the web client. Just a short time ago I was presented with another upgrade project this time it is a Web to Web upgrade. The client is currently running the older SalesLogix Web Client and would like to migrate to the 7.5.2 client.

Things had been going along very smooth until I get to one item; the client would like to have a new lookup displaying the Team names inside this lookup. Well, this seemed to me like  a pretty simple task however, I was surprised to learn it took a little more than I thought.

First I tried using the Lookup control: Using the OwnerRights object to get the listing of team names. While this started out simple for me soon I realized that I was getting multiple returns for all the SeccodeDescriptions in the database, when I tried to apply the filter as a Owner.type = 2, the lookup wouldn’t return anything.

After a few tries at resolving these issues and not having much luck I choose to try a technique used in the LAN client many times. What if I could create the picklist dynamically, make a SQL call into the database return what I wanted and put that into a picklist.. this would resolve my issues. I can’t say enough about the SalesLogix community and the number of people who share code and ideas because a simple search returned me something written by CustomerFX that shows how to populate a combobox in the web client.

Taking this example here is what I ended up with ——

===================== CODE =====================

// Added to gather Selection of SalesLogix Team Names and populate bombo box with the names to simulate lookup control.
// First gather all team names, then bind the resulting list to control and add a blankline so control will show nothing if

// there is no data in the field.
using (Sage.Platform.Orm.SessionScopeWrapper session = new Sage.Platform.Orm.SessionScopeWrapper())
{

cboTeam.Items.Clear();
cboTeam.Items.Insert(0, new ListItem(” “, ” “));
// Get List of Teams from the database
string qry = String.Format(“Select SecCodeDesc From Seccode Where SeccodeType = ‘G’”);

NHibernate.IQuery query = (NHibernate.IQuery)session.CreateSQLQuery(qry).AddScalar(“SecCodeDesc”, NHibernate.NHibernateUtil.String);

System.Collections.IList list = query.List();
list.Add(“”);

cboTeam.Items.Clear();
cboTeam.DataSource = list;
cboTeam.DataBind();
cboTeam.Items.Insert(0, new ListItem(” “, ” “));

}

======================= END OF  CODE ===============

This turned into a good working solution for my issue at hand. Next some interaction with a WebService.. lets see how that falls out.

Advertisement

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

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 )

Connecting to %s

Follow

Get every new post delivered to your Inbox.