Manipulating the PickList control server side in the Saleslogix web client

I recently had a client who was using a picklist on a quickform that was storing the PickList Id rather than the Text value.  The storage of the selected value was working fine, but when the page was reloaded after selecting something, nothing was showing in the text box of the picklist control.

The picklist control is a composite control.  Saleslogix only exposes the PickListValue property in their control which was storing the Item Id.  We couldn’t set that to be the text of the picklist because that was the bound property and would write that to the database.  So what to do?

Well as I mentioned the picklist is a composite control.  We can access its components using the controls collection.

Looping through that we can find the text box control within the picklist control and set that to be whatever we wanted.

Here is the code to do so.  Note that account.Field is my binding path and Picklist1 is the name of my picklist control:

Sage.Entity.Interface.IAccount account = this.BindingSource.Current as Sage.Entity.Interfaces.IAccount;

    if (!string.IsNullOrEmpty(account.Field))
        foreach (Control c in Picklist1.Controls)
            if (c.ClientID.EndsWith(“_Text”))
                Sage.SalesLogix.PickLists.PickList pl = Sage.SalesLogix.PickLists.PickList.GetPickListById(account.Field);
                ((TextBox)c).Text = pl.Text;

Adding this code to the form open allows the text to display correctly.  This code can be used to also do more interesting things, like display both the Short Text and Text of the selected item, etc.


Kris Halsrud

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

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!