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
   Official Infor CRM Acquisition FAQ
What to expect now that Saleslogix is Infor CRM. Like many of you, it will take some time (probably a
Posted on Sep 18, 2014 by Brianna Ojard to The Inbox
 
   Problem with the Clean Build Folders option in Application Architect
On occasion, it becomes necessary to clean out the build folders and deployed website prior to a build/de
Posted on Sep 16, 2014 by Jason Buss to Jason Buss' Blog
 
   Restricting Adding Opportunity Contacts to Contacts at the Opportunity's Account
 One thing that clients have asked for is how to restrict the selection of the Opportunity Contacts
Posted on Sep 09, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   How do I access the new Opportunity that I created in Saleslogix??
I had a user ask why they could not access a Salelogix opportunity when they clicked the hyperlink from t
Posted on Sep 04, 2014 by Dale Richter to SalesLogix Questions & Answers
 
   Configuring and Packaging secured actions in Saleslogix 8.0
Using Secured Actions, you can restrict access to user interface elements in the Saleslogix web client.
Posted on Aug 12, 2014 by Jason Buss to Jason Buss' 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