Login / Register  search  syndication  about

          Kris Halsrud's Blog

Kris Halsrud on development and Integration with CRM and Development

Sales Order Bill To Ship To tab will not work properly when contacts have more than one of the same address description

 I recently was asked about a problem in the SalesLogix web client where the Bill To Ship To tab throws an error if either the Bill To or Ship To contact has more than one address with the same description.

 

If you look at the load event of the form you can see it is using a code action item like this:

        System.Web.UI.WebControls.ListItem billingItem;
        lstbxBillingAddress.Items.Clear();
        if (salesOrder.BillingContact != null)
        {
            System.Collections.Generic.IList<Sage.Entity.Interfaces.IAddress> billingAddresses = Sage.Platform.EntityFactory.GetRepository<Sage.Entity.Interfaces.IAddress>().FindByProperty("EntityId", salesOrder.BillingContact.Id.ToString());
            if (billingAddresses != null)
            {
                foreach (Sage.Entity.Interfaces.IAddress address in billingAddresses)
                {
                    billingItem = new System.Web.UI.WebControls.ListItem();
                    billingItem.Text = address.Description;
                    billingItem.Value = address.Id.ToString();
                    billingItem.Selected = address.Description.Equals(salesOrder.BillingAddress.Description);
                    lstbxBillingAddress.Items.Add(billingItem);
                }
            }
        }

The problem is in the line shown above in red, where the are selecting the address in the list based on if it is the same description as the sales order's address.  Since this is a single select list box it will not allow you to multi-select the same description if it exists.

A work around is to handle catching if an address has already been selected. Like so:

            System.Web.UI.WebControls.ListItem billingItem;
            lstbxBillingAddress.Items.Clear();
            if (salesOrder.BillingContact != null)
            {
                Sage.Platform.RepositoryHelper<Sage.Entity.Interfaces.IAddress> repository = Sage.Platform.EntityFactory.GetRepositoryHelper<Sage.Entity.Interfaces.IAddress>();
                Sage.Platform.Repository.ICriteria criteria = repository.CreateCriteria();
                criteria.Add(repository.EF.Eq("EntityId", salesOrder.BillingContact.Id.ToString()));
                criteria.AddOrder(repository.EF.Asc("Description"));
                System.Collections.Generic.IList<Sage.Entity.Interfaces.IAddress> billingAddresses = criteria.List<Sage.Entity.Interfaces.IAddress>();

                //System.Collections.Generic.IList<Sage.Entity.Interfaces.IAddress> billingAddresses = Sage.Platform.EntityFactory.GetRepository<Sage.Entity.Interfaces.IAddress>().FindByProperty("EntityId", salesOrder.BillingContact.Id.ToString());
                if (billingAddresses != null)
                {
                    bool selection = false;
                    foreach (Sage.Entity.Interfaces.IAddress address in billingAddresses)
                    {
                        billingItem = new System.Web.UI.WebControls.ListItem();
                        billingItem.Text = address.Description;
                        billingItem.Value = address.Id.ToString();
                        if (address.Description.Equals(salesOrder.BillingAddress.Description) && !selection)
                        {
                            billingItem.Selected = true;
                            selection = true;
                        }

                        lstbxBillingAddress.Items.Add(billingItem);
                    }
                }
            }

The pertinent changes to the code are shown in red. 

Also note, in the green lines, I have also modified the code to retrieve the list of addresses sorted alphabetically by description, unlike the OOTB screen which has no sort.

A pretty easy fix to make to the screen to let you work with contacts having the same description.  If you do have a lot of the same descriptions for addresses, it might be worth adding some additional descriptive information into the list, like

billingItem.Text = address.Description + " - " + address.City;

What's This?
  
Bookmark and Share

About Kris Halsrud

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


Related Content
   CRITICAL Issue with Saleslogix v8.1 Web SNC 02- Breaks Compatability with SQL 2008R2
One of the listed fixes in SNC 02 for Saleslogix 8.1 is listed as:14095222 Enhance the SQL generation to
Posted on Apr 17, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Editing Filters in Saleslogix Web Client 8.0
Is it possible to add or remove Saleslogix filters from the List view in Accounts?
Posted on Apr 08, 2014 by SalesLogix Support to SalesLogix Questions & Answers
 
   Bug in the Saleslogix Web LiveGrid Lookup dialog
I recently ran into an issue with the Opportunity Products grid in the Saleslogix web client.  I cli
Posted on Apr 04, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Saleslogix Web Client Controls are Missing
Every so often we hear that a user can no longer add products to an opportunity whether it is a new oppor
Posted on Mar 24, 2014 by Mark Duthoy to SalesLogix Support
 
   Major Problem in Saleslogix v8.1 Cloud Instances
I have been working with a new client who is on the hosted cloud solution for Saleslogix version 8.1.&nbs
Posted on Mar 19, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
Comments

No Comments

Leave a Comment

(required)  
(optional)
(required)  
Add
All contents Copyright © 2014 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