Solution For Separate Filtering Of Account Billing and Shipping Address Fields (e.g. State)

We need to allow separate filtering on the Account Shipping Address Fields (e.g. State) and the Billing Address fields. We also would like this for the Contact address fields. Has anyone developed a solution for this? 

Details...

This started with a question about what the "State" filter in the Contacts module was filtering on. Based on the Studio / Contacts / Layouts / Search (see screenshot in Note) list, the State filter uses the address_state field, but there is not a field in Studio / Contacts / Fields called that. What is the "address_state" (and "address_country", "address_postalcode", ...) field?

I did a test of "State" filtering a Contact with Primary Address State "CA" and an Alternate Address State "WA", the Contact came back in results regardless of whether I searched "State" for "WA" or "CA"! The only thing I can think of is that "address_XXXX" are special fields that search across Primary and Alternate Address fields, but I couldn't find documentation of this in Contact module or elsewhere.


  • Hello Vince,

     

    When searching for State in the contacts module Sugar will query for both primary_address_state and alt_address_state fields in the DB.

    This means that it will retrieve the record if the state is present in either the Primary Address OR the Alternate Address.

    In Accounts mode the behavior is very similar, Sugar will search for occurrences in the fields billing_address_state and shipping_address_state.

     

    If you need more granularity, the easiest solution would be to create a Report, on the Reports module you can specify which State field you want to filter from both In Contacts and in Accounts

    If you want to add these specific fields in the List View filters, that needs to be done via code customization.

    You can have a look at the file ‘custom/modules/Accounts/clients/base/filters/default/default.php’ to understand how it works. This file is created from Studio when you save a new filter layout. Adding the options that you desire on that file will have the following result:

    I hope this helps. 

  • Hi Vince,
    This can be achieved via code customization. We will need to add a new field in the filters if you want to filter the results separately based on the primary state and alternate state. Otherwise, as Andre said, you can generate a report based on the specific field to get the desired results.
    We at Rolustech are certified SugarCRM partners. Our in-house team of Sugar experts can help you customize your code in order to suit your needs. Feel free to get in touch with us.
  • Hello Vince,

    There is always an option to go in Sugar developing for the needs
    But in many cases, a no-code configuring approach could be applied.

    There are two complementary no-code tools for SugarCRM:
    - LogicBuilder -  for configuring Sugar logic behavior via drawing flowcharts
    - Studio - for configuring fields and interfaces

    With the no-code Studio tool, we are in a position to add 2 additional calc fields - per one for each address’s State field, and use those calc fields for search.
    This will make Sugar list filtering not feed you with companies to bill to e.g. Wyoming while you set the filter for shipping to Wyoming.

    Here is how to configure that in 3 steps:

    1. Open Studio
    2. Add 2 calculated fields billing state search and shipping state search for Account

        

    1. Add new fields to Account Search

    Now, if to Open the list of Accounts and perform Recalculate Values filling out brand new fields with states names for all the Accounts, then the filter will provide the required filtering behavior:

     

    Vince,
    If you need any other adjustments, please feel free to drop me a line to dch@integroscrm.com

    If possible, we always suggest no-code solutions first for our customers, because employing no-code tools saves time and subscriber’s budget when it is necessary to set up and support Sugar platform that performs according to unique subscribers' needs.

    Best Regards,
    Dmytro Chupylka

    integroscrm.com
    We make work in Sugar CRM system faster, more convenient and efficient